2013-12-23 113 views

回答

1

你缺少$ FNAME,LNAME $查詢也使用NULL的ID,如果自動遞增

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt) 
VALUES (NULL, '$username', '$fname', '$lname', '$password', '$email', '$salt')"; 
0

你逝去錯誤的列名稱數量。您的正確查詢應該如下所示:

$query = "INSERT INTO member (username,password,email,salt) 
VALUES ('$username', '$password', '$email', '$salt')"; 
0

您並未將值插入查詢中指定的所有列。

在查詢

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt) 
VALUES ('$username', '$password', '$email', '$salt')"; 

要指定7列,只有4個值。所以無論是添加更多的值或刪除查詢中指定不必要的列像

$query = "INSERT INTO member (username, password,email, salt) 
VALUES ('$username', '$password', '$email', '$salt')"; 

OR

$query = "INSERT INTO member (id, username,fname,lname,email, password, salt) 
VALUES ('$id', '$username','$fname','$lname','$email', '$password', '$salt')"; 
+0

感謝您的回覆 –

+0

其工作正常 –