简体   繁体   中英

sql error how to fix it

I am running this sql in php

$sql = "INSERT INTO ".TABLE_PREMIUM." (Installation_ID, Purchase_ID, Enabled, Expired, Updated) VALUES('$installation', '$product', '1','$expiry', now()) ON DUPLICATE KEY UPDATE Installation_ID='$installation, Purchase_ID='$product', Enabled = '1', Expired = '$expiry', Updated = now() ";

And I keep getting this error

INSERT INTO Premium (Installation_ID, Purchase_ID, Enabled, Expired, Updated) VALUES('123456', '1111.22222222.3333.44444', '1','2016-05-13 11:10:09', now()) ON DUPLICATE KEY UPDATE Installation_ID='123456, Purchase_ID='1111.22222222.3333.44444', Enabled = '1', Expired = '2016-05-13 11:10:09', Updated = 2015-03-03 11:11:11

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 '1111.22222222.3333.44444', Enabled = '1', Expired = '2016-05-13 11:10:09', Updat' at line 1

What could be the issue? I can't decode it from this error

您在UPDATE Installation_ID='$installation后缺少' (单引号)

我认为购买 ID 太长,或者可能是您缺少 ' after installation_id = '$installation 也许这可能是问题所在。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM