我後最近更新的託管的PHP版本我有錯誤在我的網站,在這裏是錯誤消息棄用功能mysql_db_query錯誤
Deprecated: Function mysql_db_query() is deprecated in /my_path/file.php on line 13
Deprecated: Function mysql_db_query() is deprecated in /my_path/file.php on line 14
這裏的file.php
require_once("db.php"); // connect
$timeoutseconds = 100;
$timestamp=time();
$timeout=$timestamp-$timeoutseconds;
mysql_db_query($db, "INSERT INTO online VALUES ('$timestamp','$REMOTE_ADDR','$PHP_SELF')") or die("0 Users online"); // this is line 13 that shows error
mysql_db_query($db, "DELETE FROM online WHERE timestamp<$timeout") or die("0 Users online"); // this is line 14 that shows error
代碼有沒有解釋這個錯誤,以及如何解決它? 〜感謝
注:我知道mysqli
和pdo
但因爲我的網站主要取決於mysql
和意志需要幾個月做重大調整,因此請你能堅持與mysql
不能轉移到任何。
mysqli_ *基本上是mysql_ *帶有i。編輯:當然,更新/更好的代碼。 – Rogue
你應該更新你的代碼來使用mysqli_函數,如果你不使用OO方法,它不應該需要對代碼做太多的改變。 – Naryl
停止使用不推薦使用的庫。 – Kermit