Home > Article > Backend Development > What should I do if the PHP update statement fails to execute?
Solution to the failure of php update statement execution: 1. Open the corresponding PHP file; 2. Find the "update set name='1231' from xsb where sex= '...'" statement; 3. Modify The update statement is "update set from xsb name='1231' where sex= '...'".
The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.
What should I do if the PHP update statement fails to execute?
Specific problem description:
php update statement cannot be executed
<? $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>"; } ?>
This is the code I wrote, it always fails. why?
Solution to the problem:
update set name='1231' from xsb where sex= '女'
is changed to
update set from xsb name='1231' where sex= '女'
Recommended study: "PHP Video Tutorial"
The above is the detailed content of What should I do if the PHP update statement fails to execute?. For more information, please follow other related articles on the PHP Chinese website!