我正在看看,但我似乎沒有找到正確的答案,我遇到了這個問題。每當我運行這個更新MySQL腳本,它會調用錯誤:PHP MySQL更新導致錯誤
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Email='[email protected]', Phone='123456780', Address='16 Remote Street',' at line 1
這是我用來得到這個錯誤的代碼。
<?php
include ('cfg_prop.php');
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$secondemail = $_POST['secondary'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$country = $_POST['country'];
$postcode = $_POST['postcode'];
$company = $_POST['company'];
$city = $_POST['city'];
$sql = "UPDATE users SET Firstname='$firstname', Lastname='$lastname', Email='$email', Secondary Email='$secondemail', Phone='$phone', Address='$address', Country='$country', Postcode='$postcode', Company='$company', City='$city' WHERE Username='$userss'";
mysql_query($sql) or die(mysql_error());
?>
如果有人可以幫助我,我會非常高興和感激,因爲我似乎無法克服這一點。先謝謝您的幫助。
- 阿爾特拱
感謝大家的幫助。有效。我真的很感激它們! –
'當您決定哪個答案對您最有幫助時,請點擊答案左側的複選框大綱以將其標記爲已接受的答案。http://stackoverflow.com/faq#howtoask – hsz
@ hsz好。我去做。 –