gpt4 book ai didi

php mysql更新错误

转载 作者:行者123 更新时间:2023-11-29 02:07:06 25 4
gpt4 key购买 nike

代码:

mysql_connect('localhost','root','root');
mysql_select_db('share_counter');

$sql_insert = "UPDATE wpshare SET '$social_name'='45' where post_title = '$post_title' ";
mysql_query($sql_insert) or die(mysql_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 ''twitter_count'='45' where post_title = 'test'' at line 1

提前致谢

最佳答案

省略 $social_name 上的引号

$sql_insert = "UPDATE wpshare SET $social_name='45' where post_title = '$post_title' ";

关于php mysql更新错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4183345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com