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')).")";
4
  • Have you printed that string to see what it actually looks like? Was your DB_PREFIX defined as a constant? How? Commented Jun 25, 2022 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. Commented Jun 25, 2022 at 21:54
  • Are you sure that $this->config->get('glami_size_options') always contains data? Otherwise, the query will fail. Commented Jun 25, 2022 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. Commented Jun 25, 2022 at 23:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.