10-31-2020, 03:07 AM
Mean thanks for allowing me to retrieve values in get with the statement $ search = $ this-> input-> get, I'm trying to use the same method for an internal search engine in my western film library but I can't find the key to the problem. In the Model di CI versione 3.0 I put:
MODEL:
function estrai($search)
{
$query= $this->db->select('*')
->from('western')
->where('anno')
->like('anno', '$search')
->get();
return $query->result();
}
VIEW:
public function mostramodulo()
{
$search = $this->input->get('search');
$data['result'] = $this->western_model->estrai($search);
$this->load->view('western/mostramodulo', $data);
}
I have a form with a text field and a submit which sends data on the text which has the name search. the information is sent correctly because in url I see:
/index.php/home/mostramodulo?search=Ford&search=
but the result is a blank page so I tried to print the value in transit which should become $ search with ECHO but it confirms my doubts is that there is no value inside and therefore I cannot graphically build the page because the model does not work.
but when i try to view the page i see the message
Severity: Notice
Message: Undefined variable: search
Filename: western/mostramodulo.php
do you have any suggestions to be able to extract from the engine the name of a director or the year in which the film was shot with subsequent materialization of the data sought? Thanks for any tips, I'm at the beginning and not framed everything well, on the CI 3 documentation I did not find the use of the LIKE linked to WHERE clear to me
MODEL:
function estrai($search)
{
$query= $this->db->select('*')
->from('western')
->where('anno')
->like('anno', '$search')
->get();
return $query->result();
}
VIEW:
public function mostramodulo()
{
$search = $this->input->get('search');
$data['result'] = $this->western_model->estrai($search);
$this->load->view('western/mostramodulo', $data);
}
I have a form with a text field and a submit which sends data on the text which has the name search. the information is sent correctly because in url I see:
/index.php/home/mostramodulo?search=Ford&search=
but the result is a blank page so I tried to print the value in transit which should become $ search with ECHO but it confirms my doubts is that there is no value inside and therefore I cannot graphically build the page because the model does not work.
but when i try to view the page i see the message
Severity: Notice
Message: Undefined variable: search
Filename: western/mostramodulo.php
do you have any suggestions to be able to extract from the engine the name of a director or the year in which the film was shot with subsequent materialization of the data sought? Thanks for any tips, I'm at the beginning and not framed everything well, on the CI 3 documentation I did not find the use of the LIKE linked to WHERE clear to me