Home > Backend Development > PHP Problem > What should I do if the PHP update statement fails to execute?

What should I do if the PHP update statement fails to execute?

藏色散人
Release: 2023-03-17 15:26:01
Original
5980 people have browsed it

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= '...'".

What should I do if the PHP update statement fails to execute?

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(&#39;localhost&#39;,&#39;root&#39;,&#39;1&#39;) or die(&#39;连接失败&#39;);
mysql_select_db(&#39;xsxx1&#39;,$con) or die(&#39;选择数据库失败&#39;);
mysql_query("SET NAMES gb2312");
$updatesql="update set name=&#39;1231&#39; from xsb where sex= &#39;女&#39; ";
$update = mysql_query($updatesql,$con);
// 检测修改操作是否成功
if ($update){
echo "修改记录成功!";
echo "<br>";
}
else
{
echo "修改记录失败!";
echo "<br>";
}
?>
Copy after login

This is the code I wrote, it always fails. why?

Solution to the problem:

update set name=&#39;1231&#39; from xsb where sex= &#39;女&#39;
Copy after login

is changed to

update set from xsb name=&#39;1231&#39; where sex= &#39;女&#39;
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template