0

can you help me update this script for compatibility with php7? I get error: Uncaught Exception: 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 ')' at line 1

$qry = "SELECT oo.`value` FROM " . DB_PREFIX . "order_option AS oo INNER JOIN " . DB_PREFIX . "product_option_value AS pov ON (oo.product_option_id = pov.product_option_id AND oo.product_option_value_id = pov.product_option_value_id) WHERE oo.order_id = '".$order_id."' AND oo.order_product_id = '".$order_product_id."' AND pov.option_id IN (".implode(",", $this->config->get('glami_size_options')).")";
IMSoP
  • 89,526
  • 13
  • 117
  • 169
k4mk4m
  • 1
  • 1
  • Have you printed that string to see what it actually looks like? Was your DB_PREFIX defined as a constant? How? – Tim Roberts Jun 25 '22 at 21:52
  • That error message isn't from PHP, it's from your database; PHP is just reporting it to you. You'll need to look at the SQL you've generated, and find the syntax error. While you're working on it, you could start [using parameterized queries, to protect from SQL Injection attacks](https://stackoverflow.com/q/60174/157957). – IMSoP Jun 25 '22 at 21:54
  • Are you sure that `$this->config->get('glami_size_options')` always contains data? Otherwise, the query will fail. – Chrostip Schaejn Jun 25 '22 at 21:58
  • There's nothing here which is obviously incompatible with PHP7. And as others have mentiond, the error is clearly a SQL error, not a PHP error, anyway. – ADyson Jun 25 '22 at 23:47

0 Answers0