Столкнулся со следующей ошибкой
Fatal error: Uncaught exception 'ErrorException' with message '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 'update toyshop_product set price=738 where sku like ('1109507') limit 1; update' at line 2<br />Error No: 1064<br />update toyshop_product set price=624 where sku like ('1114612') limit 1; update toyshop_product set price=738 where sku like ('1109507') limit 1; update toyshop_product set price=957 where sku like ('1118691') limit 1; update toyshop_product set price=2738 where sku like ('1110266') limit 1; update toyshop_product set price=1863 where sku like ('1131626') limit 1; update toyshop_product set price=2113 where sku like ('1131628') limit 1; update toyshop_product set price=4938 where sku like ('1131627') limit 1; update toyshop_product set price=312 where sku like ('1110346') limit 1; update toyshop_product set price=319 where sku like ('1110355') limit 1; update toyshop_product set price=349 where s in
Есть php код который генерирует запросы.
$margin = $this->config->get('margin');
$rate_margins = floatval($margin)/100+1;
$q = array();
foreach($goods as $itm)
{
$newPrice = ceil(floatval($itm[10])*$rate_margins);
$q[] ="update " . DB_PREFIX . "product set price={$newPrice} where sku like ('{$itm[3]}') limit 1;";
}
$sql = implode("\n", $q);
$query = $this->db->query($sql);
Если вардампить запрос, и выполнить его в heidiSQL то все ок, все работает, если совершать запросы прямо в цикле, то все тоже ок. А вот при раскладе выше - фатал, в чем проблема никак не пойму.
PS. часть дампа запросов
update toyshop_product set price=624 where sku like ('1114612') limit 1;
update toyshop_product set price=738 where sku like ('1109507') limit 1;
update toyshop_product set price=957 where sku like ('1118691') limit 1;