0
我在解決我的代碼時出現問題..我已經看到了此代碼並由我自己編輯,但我想更改錯誤消息以彈出警報,由客戶端輸入提交彈出消息後的現有值將出現,並說示例代碼已被使用更改錯誤消息以彈出消息
if($scode != '') {
$qry = "SELECT * FROM toxintablemonitoring WHERE sampleCode='$scode'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0) {
$errmsg_arr[] = 'Sample Code already in use';
$errflag = true;
}
@mysql_free_result($result);
}
else {
die("Query failed");
}
}
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: sample_input_monitoring_toxin.php");
exit();
}
[**在新的代碼,請不要使用'mysql_ *'功能**](http://bit.ly/phpmsql)。他們不再被維護[並被正式棄用](https://wiki.php.net/rfc/mysql_deprecation)。看到[**紅框**](http://j.mp/Te9zIL)?學習[*準備的語句*](http://j.mp/T9hLWi),並使用[PDO](http://php.net/pdo)或[MySQLi](http://php.net/ mysqli) - [這篇文章](http://j.mp/QEx8IB)將幫助你決定哪個。如果你選擇PDO,[這裏是一個很好的教程](http://j.mp/PoWehJ)。 – j0k