有人可以幫我解決這個問題嗎? 這裏是我的PHP代碼,但我卡住的錯誤:無法輸入數據:您的SQL語法錯誤;
Could not enter data: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
如何解決它?
$sql = "INSERT INTO pemohon2(p_id,k_nom_siri,p_jenis_aset,p_pengguna_terakhir,p_tarikh_rosak) SELECT P_ID,K_nom_siri,P_jenis_aset,P_pengguna_terakhir,P_tarikh_rosak FROM pemohon)";
mysql_select_db('kenderaan');
$retval = mysql_query($sql, $conn);
if(! $retval) {
die('Could not enter data: ' . mysql_error());
}
mysql_close($conn);
請[停止使用'mysql_ *'功能(http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php)。 [這些擴展](http://php.net/manual/en/migration70.removed-exts-sapis.php)已在PHP 7中刪除。瞭解[編寫](http://en.wikipedia.org/ wiki/Prepared_statement)語句[PDO](http://php.net/manual/en/pdo.prepared-statements.php)和[MySQLi](http://php.net/manual/en/mysqli.quickstart .prepared-statements.php)並考慮使用PDO,[這真的很簡單](http://jayblanchard.net/demystifying_php_pdo.html)。 –
致命錯誤:調用未定義的函數mysqli_connect()in..i在使用mysqli時遇到此錯誤。爲什麼? – mzml