'' 附近的 SQL 查询错误

编程入门 行业动态 更新时间:2024-10-26 00:31:52
本文介绍了'' 附近的 SQL 查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 UPDATE ".$tablename." SET stock=%s WHERE itemname=".$itemname."

SQL 查询抛出此错误:

SQL Query throwing this error:

您的 SQL 语法有错误;检查手册对应于您的 MySQL 服务器版本以使用正确的语法靠近第 1 行的 ''

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

无法找到它在谈论什么,因为它只给我 '' 而不是查询中的任何文本.谢谢!

Can't find what it is talking about as it only gives me '' and not any text in the query. Thanks!

推荐答案

上面的字符串拼接看起来真的很乱!我会去做一些简单的事情:

The string concatenation above looks really messy! I would go for something simple:

$sql = "更新 $tablename SET stock='$stock' WHERE itemname='$itemname'";

如果这不起作用,您应该调试以下值:$tablename, $stock 和 $itemname

If this doesn't work, you should debug the values of : $tablename, $stock and $itemname

ps.我已经给尼克 +1 了 :)

ps. I've already given +1 to Nick :)

更多推荐

'' 附近的 SQL 查询错误

本文发布于:2023-10-22 23:12:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519010.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!