php更新语句执行失败的解决办法:1、打开相应的PHP文件;2、找到“update set name='1231' from xsb where sex= '...'”语句;3、修改更新语句为“update set from xsb name='1231' where sex= '...'”即可。

本教程操作环境:Windows7系统、PHP8.1版、Dell G3电脑。
php更新语句执行失败怎么办?
具体问题描述:
php update语句无法执行呢
立即学习“PHP免费学习笔记(深入)”;
<?
$con=mysql_connect('localhost','root','1') or die('连接失败');
mysql_select_db('xsxx1',$con) or die('选择数据库失败');
mysql_query("SET NAMES gb2312");
$updatesql="update set name='1231' from xsb where sex= '女' ";
$update = mysql_query($updatesql,$con);
// 检测修改操作是否成功
if ($update){
echo "修改记录成功!";
echo "<br>";
}
else
{
echo "修改记录失败!";
echo "<br>";
}
?>这是我写的代码,总是显示失败,为什么呢?
问题解决办法:
update set name='1231' from xsb where sex= '女'
改为
update set from xsb name='1231' where sex= '女'
推荐学习:《PHP视频教程》
以上就是php更新语句执行失败怎么办的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号