Welcome Guest, Not a member yet? Register   Sign In
Small question regarding DB query?
#1

[eluser]Solarpitch[/eluser]
I've convinced myself that this is the right way of doing a LIKE mysql query but it doesnt seem to work. Just want to check if its correct... seems to be going by the documentaion anyway.

Code:
function search($term)
{
    
$this->client->get('sales');
$query = $this->client->like('receipt', $term);

return $query->result();
        
}
#2

[eluser]therealmaloy[/eluser]
Solarpitch

you need to be aware that get() is the run/execution of your sql statement..

make the like() first before the get() function..

Code:
$this->client->like('receipt', $term);

$query = $this->client->get('sales');
#3

[eluser]Solarpitch[/eluser]
Ah right. I was thinking you needed to use the get() first, then apply the LIKE clause. So its basically the same idea as using get_where() or that.

Thanks again for your help Smile




Theme © iAndrew 2016 - Forum software by © MyBB