CodeIgniter Forums
MySQL error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: MySQL error (/showthread.php?tid=22298)



MySQL error - El Forum - 09-04-2009

[eluser]webnology[/eluser]
Hi all,

after copying some files back to the server, I have some errors in my SQL. For example, this one:


A Database Error Occurred

Error Number: 1064

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 ') OR (users2users.validated = 1 AND users2users.user_id2 = 67)' at line 4

SELECT * FROM (`users2users`) JOIN `users` ON `users`.`id` = `users2users`.`user_id2` OR users.id = users2users.user_id1 WHERE `(users2users`.`validated` = 1 AND users2users.user_id1 = 67) OR (users2users.validated = 1 AND users2users.user_id2 = 67)

The code is:
Code:
$where = "(users2users.validated = 1 AND users2users.user_id1 = " . $userid . ") OR (users2users.validated = 1 AND users2users.user_id2 = " . $userid . ")";
$this->db->where($where);



Why does this suddenly happen? It worked all fine before. Could there have been a mySQL upgrade on the server?

Kind regards, all help appreciated,
M


MySQL error - El Forum - 09-04-2009

[eluser]webnology[/eluser]
Sorry guys, never mind. Solved.

Thx,
M