本文介绍了Php更新数据库无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个应该更新数据库详细信息的代码,但它不起作用。
有一条错误消息说
i have a code which should update the database details, However it doesn't work.
There is a Error message which says
Quote:
错误你的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在'='Nic'附近使用正确的语法,fullname ='F_Name',address ='Address',contact ='Contact',color ='Col'在第1行
ErrorYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'Nic',fullname = 'F_Name',address = 'Address',contact = 'Contact',color = 'Col' at line 1
我的尝试:
What I have tried:
$connnect= mysqli_connect ("localhost","root","1234","latgsjason");
if (mysqli_connect_error()){
echo"Failed to Connect";
}
$VRegno= $_POST['V_Regno'];
$Nic=$_POST['Nic'];
$FullName=$_POST['F_Name'];
$Address=$_POST['Address'];
$Contact=$_POST['Contact'];
$Color=$_POST['Color'];
$sql = "Update customer SET nic='$Nic',fullname ='$FullName',address='$Address',contact='$Contact',color='$Color' where veh_regno='$VRegno'";
if(!mysqli_query($connnect,$sql))
{
die("Error".mysqli_error($connnect));
}
echo"Update Successfully ";
if(!isset($conn)){
mysqli_close($conn);
}
推荐答案
这篇关于Php更新数据库无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!