CodeIgniter Forums
SQL query errors in Code Ignitor but runs fine in PhpMyAdmin & Navicat - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: SQL query errors in Code Ignitor but runs fine in PhpMyAdmin & Navicat (/showthread.php?tid=11042)



SQL query errors in Code Ignitor but runs fine in PhpMyAdmin & Navicat - El Forum - 08-23-2008

[eluser]morph london[/eluser]
I have the following database error, but when I copy the the query in the error into Navicat or PhpMyAdmin it executes correctly. Seems strange.


Code:
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 '; SELECT `events_type`.`type`, `events_type`.`title` as type_title, `events`.`' at line 1

SET @rank=0; SELECT `events_type`.`type`, `events_type`.`title` as type_title, `events`.`title`, `events`.`id`, `events`.`content`, `events`.`date`, `events`.`price`, `events`.`permalink`, `events`.`finish`, `events`.`hasfinish`, `events`.`venue`, `events`.`rank`, `events`.`abstract`, `events`.`buylink` FROM (SELECT *,@rank := @rank + 1 AS rank FROM events ORDER BY DATE ASC) AS `events` Inner Join `events_type` ON `events`.`events_type_id` = `events_type`.`id` WHERE `events`.`status` = 1 AND `events`.`date` >= '2008-10-02 19:01:00' AND (`events`.`age` = 10 OR `events`.`age` = 17 OR `events`.`age` = 19) ORDER BY date ASC LIMIT 3