heyy guys ....
我知道这可能是一个愚蠢的错误,但我真的很努力地解决这个错误,但似乎无法找到原因......
$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();
如果有人可以指出我的错误,我将不胜感激......
谢谢
- 更新 -
错误:
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'";
答案 0 :(得分:1)
如果没有确切的错误消息很难离开,但这些(sql1,sql2等)应该是变量(用$标记):
$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'";
答案 1 :(得分:0)
你忘了把$
放在变量之前
$sq1
等,