近日凍仁使用 PROCEDURE 及動態 LIMIT 改寫某 PHP 網站的 列出最後 10 筆資料 功能,套上新程式碼後,再持續送出 query 就會跳「 Commands out of sync; you can't run this command now」的錯誤訊息,其 MySQL 文件的解釋如下: 18.2.8 Commands out of sync in client 錯誤 如果你在你的客戶代碼中得到 Commands out of sync; You can't run this command now,你正在以錯誤的次序調用客戶函數! 這可能發生,例如,如果你正在使用 mysql_use_result() 並且在你已經調用了 mysql_free_result() 之前試圖執行新查詢。如果你在 mysql_use_result()或mysql_store_result() 之間試圖執行返回數據的 2 個查詢,它也可能發生。
凍仁在幫 Perl 安裝 DBD 模組時,得到了錯誤訊息: 「 t/00base ......NOK 2# Failed test 'use DBD::mysql;' 」 請教 星空夜雨 後才知道這是因為 DBD 模組與 MySQL 有相依性,若沒依照 Distribution 預設的方式安裝,得手動補上參數才會過,而以下條件大概都會碰到: MySQL Server 為自行編譯。 本機無安裝 MySQL Server。 未於 MySQL Server 建立指定的測試帳號及密碼。