![](/img/trans.png)
[英]mssql_query(): message: Incorrect syntax near ',' --COALESCE
[英]I have got an error On SQL query - PHP-SQLWarning: mssql_query(): message: Incorrect syntax near '='. (severity 15)
我正在用sql查詢運行此php代碼,但它一直顯示此錯誤,而我找不到錯誤在哪里? 你能幫忙嗎? 提前致謝
警告:mssql_query():消息:'='附近的語法不正確。 (嚴重性15)
警告:mssql_query():常規SQL Server錯誤:檢查來自SQL Server的消息(嚴重性15)
警告:mssql_query():查詢失敗
我的user.php上有這個
if(isset($_POST['refresh'])){
$mssql_real = db_connect_real();
$sql = "UPDATE TOP(1) click_users_phones SET pin_failed = 0, status = 1, pin_blocked_time = NULL WHERE phone_num = $phone_num";
mssql_query($sql, $mssql_real);
}
我在另一個PHP文件上有這個
<form action="user.php" method="post">
<button class="#" name="refresh">Refresh</button>
</form>
更新此聲明
$sql = "UPDATE TOP(1) click_users_phones SET pin_failed = 0, status = 1, pin_blocked_time = NULL WHERE phone_num = $phone_num";
至
$sql = "UPDATE TOP(1) click_users_phones SET pin_failed = 0, status = 1, pin_blocked_time = NULL WHERE phone_num =".$phone_num;
你的SQL語句應該像
UPDATE TOP(1) A SET pin_failed = 0, status = 1, pin_blocked_time = NULL
FROM click_users_phones A WHERE phone_num = ''
注意:但是您應該記住,SQL永遠不能保證您的訂單。 因此,如果要更新TOP 1,則應在選擇中提供ORDER BY
。 這樣您將更新正確的記錄。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.