Welcome Guest, Not a member yet? Register   Sign In
SQL syntax when using Active Record Class
#1

[eluser]Linh Pham[/eluser]
Hi there,
i am using these code lines.
Quote:$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);

$this->db->where($array);
But i dont know why it says
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`!= ` 'my name'

Please help me this problem
#2

[eluser]CI_expert_indian[/eluser]
Try this dear .....

$this->db->where('name !=', $name);
$this->db->where('id <', $id);
#3

[eluser]insert_hilarity_here[/eluser]
operators in where expressions do not work in CI 2.1.1 so you cannot write

$this->db->where(‘name !=’, $name);
$this->db->where(‘id <’, $id);

because it will quote the operators != and <

https://github.com/EllisLab/CodeIgniter/issues/1469

if you are on 2.1.1 you should downgrade to 2.1.0




Theme © iAndrew 2016 - Forum software by © MyBB