$query_string = "UPDATE _notifications SET _notifications.notification_flag = 0 WHERE _notifications.notification_id = 'JTQBPULM3M' ;
UPDATE _notifications SET _notifications.notification_flag = 0 WHERE _notifications.notification_id = 'KC7KZT2JAT' ;
UPDATE _notifications SET _notifications.notification_flag = 0 WHERE _notifications.notification_id = 'M6L5T5Z2K0' ;";
$this->db->query($query_string);
Query runs fine from phpmyadmin but throws this error if ran from php:
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 ‘UPDATE _notifications SET _notifications.notification_flag = 0
WHERE _notificati’ at line 2
UPDATE _notifications
SET _notifications.notification_flag = 0
WHERE _notifications.notification_id = 'JTQBPULM3M' ;
UPDATE _notifications
SET _notifications.notification_flag = 0
WHERE _notifications.notification_id = 'KC7KZT2JAT' ;
UPDATE _notifications
SET _notifications.notification_flag = 0
WHERE _notifications.notification_id = 'M6L5T5Z2K0' ;
Assuming my supposition that the problem is that you have multiple statements in the same query, you could try this instead:
That would make it a single statement.
I’m assuming that it works in phpMyAdmin because I suspect phpMyAdmin breaks the multiple statements up into separate queries, rather than a single one. (Pure speculation there, mind.)