Page 1 of 1

order update function throwing mysql error

Posted: Fri Mar 20, 2009 2:41 am
by Qphoria
When calling the update function in catalog/model/checkout/order.php, I get this error:

Error: 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 'WHERE order_id = '7'' at line 1
Error No: 1064
INSERT INTO order_history SET order_status_id = '2', comment = '' WHERE order_id = '7'

I'm pretty sure you can't do a "WHERE" on an Insert command.

Looks like that line doesn't even belong there, as its a duplicate function of the first:
public function update($order_id, $order_status_id, $comment = '', $notifiy = FALSE) {

$this->db->query("UPDATE `order` SET order_status_id = '" . (int)$order_status_id . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "' AND confirm = '1'");

$this->db->query("INSERT INTO `order_history` SET order_status_id = '" . (int)$order_status_id . "', comment = '" . $this->db->escape($comment) . "' WHERE order_id = '" . (int)$order_id . "'");

if ($notifiy) {

Re: order update function throwing mysql error

Posted: Fri Mar 20, 2009 6:22 am
by Daniel
its required because its `order_history` not order.

Your right though its a bug.