• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WHERE-LIKE and problem for build search-engin in western movie web app

#1
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


Attached Files Thumbnail(s)
   
Reply

#2
Well it would help if you showed your code for the form also.

But what do you get when you use the code below?

PHP Code:
public function mostramodulo()
{
    $search $this->input->get('search');

    echo $this->input->get('search');
    exit();

    $data['result'] = $this->western_model->estrai($search);
    $this->load->view('western/mostramodulo'$data);


If it's blank then you are not receiving the value from your form, if you get a
value then the problem is in your model which we would need to see the code for that also.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
I would try to replace 

PHP Code:
->like('anno''$search'

with

PHP Code:
->like('anno'$search
Codeigniter 4 - Docker Image [github] [docker hub]
Reply

#4
Your theme is very good and helps me watch a lot of interesting movies on computer.
Oreo-tv.net is a very good high quality movie player that I have installed on my samsung s6 mobile phone. Reputable and high-quality oreo tv app free download on a variety of mobile devices.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.