SQL 插入错误 SQL 语法 ... date()
这是我收到的错误 1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行的 ':i:sa)、rec_type = ''、rec_request = '1'、rec_by = 'Victoria'、batch_id = UC' 附近使用的正确
语法我知道我需要在插入之前转义。我现在只是在测试。
$importwav="INSERT into names SET
com_id = '".$word_id."',
rec_date = date(d-M-y),
rec_time = date(h:i:s a),
rec_type = '".$rec_type."',
rec_request = '1',
rec_by = '".$data[8]."',
batch_id = UCASE('".$batchid."')
";
INSERT into names SET com_id = '87', rec_date = date(d-M-y),
rec_time = date(h:i:s a), rec_type = '', rec_request = '1',
rec_by = 'Victoria', batch_id = UCASE('Batch004AM')
This is the error i'm receiving 1064 - 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 ':i:s a), rec_type = '', rec_request = '1', rec_by = 'Victoria', batch_id = UC' at line 1
also i'm aware that I need to escape before inserting. I'm just testing right now.
$importwav="INSERT into names SET
com_id = '".$word_id."',
rec_date = date(d-M-y),
rec_time = date(h:i:s a),
rec_type = '".$rec_type."',
rec_request = '1',
rec_by = '".$data[8]."',
batch_id = UCASE('".$batchid."')
";
INSERT into names SET com_id = '87', rec_date = date(d-M-y),
rec_time = date(h:i:s a), rec_type = '', rec_request = '1',
rec_by = 'Victoria', batch_id = UCASE('Batch004AM')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您混淆了 PHP 函数和 MySQL 函数。
你的 SQL 语法是 FUBAR。
You're confusing your PHP functions and your MySQL functions.
And your SQL syntax is FUBAR.
SQL 语法不正确。
Improper SQL syntax.
date()
参数必须是字符串。尝试用单引号 ('
) 括住日期格式字符串。date()
arguments need to be a string. Try surrounding your date format strings with single quotes ('
).