[eluser]coldfire82[/eluser]
Hi,
I dont know what causing this problem. But apparently, it is produced as,
SQL Query:
Code:
SELECT id FROM cars Where name = 'BMW (series 5)'
On simply running this query on phpmyadmin/mysql, it returns the right result and gives the 'id'.
But, from my model, when I query the same as,
Code:
$sql="SELECT id FROM cars Where name = $car_name";
$query = $this->db->query($sql);
Above, the car name is db->escaped so it will be like this, "SELECT id FROM cars Where name = 'BMW (series 5)'"
The above query is correct but it returns 0 results, which is wrong. On removing the parentheses around 'series 5', it works fine. Why?
Is there anything I am missing regarding CI db query not entertaining the parentheses/brackets?
Thanks