嘗試的DIE()
末增加Mysql_error()
說會給你更多的錯誤信息。
mysql_query("INSERT INTO accounts SET positive=\"".'1'."\"") or die ("uploading error! Try diffrent base or contact dev! ".mysql_error());
一種不顯示mysql_error();
的方法,讓人們看到它。
EX:
function errorsignup($error,$details,$message)
{
if($message == "")
mysql_query("INSERT INTO er SET name=\"".$error."\",details=\"".$details."\"") or die("Error: ".mysql_error());
else
{
mysql_query("INSERT INTO er SET name=\"".$error."\",details=\"".$details."\"") or die("Error: ".mysql_error());
return $message;
}
}
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function standarderror()
{
return "OH NO... An Error Has Occured<br />We Were Not Expecting This<br />An Error Message With Details Has Been Sent To Web Admin.<br /> You May Try One Of The Following<ul><li>Try Again</li><li>Or Return To Home Page Then Try Again</li><li>Wait 24 Hours And Try Again</li><li>If Error Persists Then Please Just Wait 24 Hours.</li></ul><br />Thanks For Your Support: Web Master/Administrator - Double J Computers";
}
現在我們添加了錯誤消息每次mysql_query();
die(errorsignup('Error In Your Area: - SQL UPDATE edit - '.date('m-d-y').' - '.getRealIpAddr(),'SQL ERROR: '.mysql_error(),standarderror())); // this returns the standard error function so people have a few instructions to try again.
//this also records the area like what page and what sql edit or update or w/e and the full error
後以何種方式這裏會失敗? JavaScript代碼是否被執行?瀏覽器位置是否成功更改? PHP代碼是否執行?服務器的迴應是什麼?這裏具體發生了什麼? – David
您確定要發送非空的'account'參數嗎? – Barmar
你不會把'$ _GET [「positive」]'放到數據庫中,你總是放上'1'。 – Barmar