CodeIgniter Forums
The problem with the transmission of the value of the variable in the model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: The problem with the transmission of the value of the variable in the model (/showthread.php?tid=1296)



The problem with the transmission of the value of the variable in the model - vertisan - 02-26-2015

I have a problem. I am trying to pass the value of the variable $lider in the model but then I get an error:

PHP Code:
A PHP Error was encountered

Severity
Warning

Message
Missing argument 3 for Wolontariusze_model::pobierz_gdzie(), called in C:\WebServ\httpd\IEM2015\application\controllers\Main.php on line 25 and defined

Filename
models/Wolontariusze_model.php

Line Number
23 
and
PHP Code:
SeverityNotice

Message
Undefined variablelider

Filename
models/Wolontariusze_model.php

Line Number
27 

Why?
Here is my code:

Controller
PHP Code:
$GAMEROOM = array ( 'sekcja' => 'GAMEROOM' );
 
$lider 'LIDER GAMEROOM';
 
$data['sekcja_GAMEROOM'] = $this->Wolontariusze_model->pobierz_gdzie'wolontariusze'$GAMEROOM$lider ); 

Model
PHP Code:
public function pobierz_gdzie$tabela$warunek$lider )
 {

 
$zapytanie $this->db->where$warunek ); 
 
$zapytanie $this->db->or_where'sekcja=' $lider ); 
 
$zapytanie $this->db->get$tabela );
 return 
$zapytanie->result();

 } 



RE: The problem with the transmission of the value of the variable in the model - aurelien - 02-26-2015

Hi,

I dont know... everything seems to be OK...

Try :
- Call the model directly whithout variables : ...->pobierz_gdzie( 'wolontariusze', array ( 'sekcja' => 'GAMEROOM' ), 'LIDER GAMEROOM' );
- Initialize parameters in the model : public function pobierz_gdzie( $tabela = '', array $warunek, $lider='' )


RE: The problem with the transmission of the value of the variable in the model - vertisan - 02-26-2015

(02-26-2015, 09:21 AM)aurelien Wrote: Hi,

I dont know... everything seems to be OK...

Try :
- Call the model directly whithout variables : ...->pobierz_gdzie( 'wolontariusze', array ( 'sekcja' => 'GAMEROOM' ), 'LIDER GAMEROOM' );
- Initialize parameters in the model : public function pobierz_gdzie( $tabela = '', array $warunek, $lider='' )

Second option work, thanks Smile