Welcome Guest, Not a member yet? Register   Sign In
Using LIKE and GET
#1

[eluser]EdgeTube[/eluser]
Hi,

I have this code:
Code:
$searchstrings = $_POST['string'];
$query = $this->db->get('XXXX');
$this->db->like('manufacturer', 'searchstrings');
$this->db->or_like('model', $searchstrings);

$this->table->set_heading('Manufacturer', 'Model', 'Price');
$tmpl = array (
                    'table_open'          => '<table border="1" borderspacing="0" cellpadding="5" cellspacing="0" width="600px">',

                    'heading_row_start'   => '<tr>',
                    'heading_row_end'     => '</tr>',
                    'heading_cell_start'  => '<th>',
                    'heading_cell_end'    => '</th>',

                    'row_start'           => '<tr>',
                    'row_end'             => '</tr>',
                    'cell_start'          => '<td>',
                    'cell_end'            => '</td>',

                    'row_alt_start'       => '<tr>',
                    'row_alt_end'         => '</tr>',
                    'cell_alt_start'      => '<td>',
                    'cell_alt_end'        => '</td>',

                    'table_close'         => '</table>'
              );

$this->table->set_template($tmpl);
echo $this->table->generate($query);

I am using a form with action 'post' on the previous page.

For some reason, I believe my 'like' code is not functioning, because all the records in the table is listed.

Any ideas on how to fix the query?

Thanks!
#2

[eluser]bogdan3l[/eluser]
After $this->db->or_like('model', $searchstrings); add $this->db->limit(10);
#3

[eluser]EdgeTube[/eluser]
Cool, thanks!




Theme © iAndrew 2016 - Forum software by © MyBB