我不能執行這個查詢工作:無法與if/else語句在SQL查詢
$sl="update customers set activation_code='$reg' WHERE c_number='$users1' and password='$id'";
$result=mysql_query($sl);
if (mysql_error()) {
?>
<script type=text/javascript>
window.alert("Error, You have not used our services before, so no details for you to visit and explore");
</script>
<?php
} else {
echo $reg;
}
每次我進入細節我得到的所顯示的激活碼...意味着OS不擅長挑選我所有的if語句....請幫我解決這個 幫助我如何解決這個
以供將來參考(至少在developin g)顯示實際的SQL錯誤信息是一個好主意,當你需要像這樣的幫助時,在SO上發佈它。這條消息會告訴你到底SQL語句中你的問題在哪裏 –
另外,請停止使用MySQL擴展,因爲它受到SQL注入的限制,現在在PHP中已棄用;並學習使用MySQLi或PDO擴展的準備好的語句。 –