本文介绍了解析错误:语法错误,意外的'='错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好...
我知道这可能是一个愚蠢的错误,但我确实尽力解决了该错误,但似乎找不到原因...
i know this is probably a silly error but i really tried hard to solve this error, but can't seem to find the cause...
$id=$_GET['uid'];
$name=$_GET['uname'];
$empnum=$_GET['empnum'];
$status=$_GET['status'];
$role=$_GET['role'];
//--SQL query : Fetching data from main_data and how many data row exists
$sql1=mysql_query("SELECT * FROM $tbl_name WHERE UserID='$id'");
$count=mysql_num_rows($sql1);
if($count>0)
{
echo "User ID exists";
header("refresh:1;url=newregistration.php" );
}
else
{
//sql commands to insert the data into the database
sql1="UPDATE $tbl_name SET UserID='$id' WHERE UserID='$id'"; //sql query defined
sql2="UPDATE $tbl_name SET UserName='$name' WHERE UserID='$id'";
sql3="UPDATE $tbl_name SET EmpNumber='$empnum' WHERE UserID='$id'";
sql4="UPDATE $tbl_name SET Status='$status' WHERE UserID='$id'";
sql5="UPDATE $tbl_name SET Role='$role' WHERE UserID='$id'";
$result=mysql_query($sql1) or mysql_error();
$result=mysql_query($sql2) or mysql_error();
$result=mysql_query($sql3) or mysql_error();
$result=mysql_query($sql4) or mysql_error();
$result=mysql_query($sql5) or mysql_error();
如果有人能指出我的错误,将不胜感激...
would be grateful if someone can point out my mistake...
谢谢
-更新-
错误:
Parse error: syntax error, unexpected '=' in C:\wamp\www\ReportTrackingSystem\updateregistration.php on line 43 $sql1="UPDATE $tbl_name SET UserID='$id' WHERE UserID='$id'";
推荐答案
很难解决,没有确切的错误消息,但是这些(sql1,sql2等)应该是变量(带有$标记):
Difficult to go off of without an exact error message, but these (sql1, sql2, etc) should be variables (flagged with $):
$sql1="UPDATE $tbl_name SET UserID='$id' WHERE UserID='$id'"; //sql query defined
$sql2="UPDATE $tbl_name SET UserName='$name' WHERE UserID='$id'";
$sql3="UPDATE $tbl_name SET EmpNumber='$empnum' WHERE UserID='$id'";
$sql4="UPDATE $tbl_name SET Status='$status' WHERE UserID='$id'";
$sql5="UPDATE $tbl_name SET Role='$role' WHERE UserID='$id'";
这篇关于解析错误:语法错误,意外的'='错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!