php连接mysql 500错误日志_php javascript从mysql获取数据会在服务器端产生500错误
我在我的網頁上有一個mysql數據庫和php + js + jquery頁面。
在這個例子中,瀏覽器用這個內容加載一個php頁面:
function MuestraNoticia(str)
{
if (str=="")
{
document.getElementById("rss_rcpt").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("rss_rcpt").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","auth/peticion_noticia.php?page="+str,true);
xmlhttp.send();
}
MuestraNoticia(1);
$event=$_GET["page"];
if($page == 1){
//allow sessions to be passed so we can see if the user is logged in
session_start();
//connect to the database so we can check, edit, or insert data to our users table
$con = mysql_connect('localhost', 'user', 'pwd') or die(mysql_error());
$db = mysql_select_db('dbname', $con) or die(mysql_error());
$SQL = "SELECT * FROM tablename";
$result = mysql_query($SQL);
echo "
echo "
";$GLOBALS['normalizeChars'] = array(
'á'=>'á', 'é'=>'é', 'í'=>'í', 'ó'=>'ó', 'ú'=>'ú', '?'=>'?',
'á'=>'á', 'é'=>'é', 'í'=>'í', 'ó'=>'ó', 'ú'=>'ú', '?'=>'?'
);
function arregla($toClean){
return strtr($toClean, $GLOBALS['normalizeChars']);
}
while ($row = mysql_fetch_array($result)) {
arregla($row['contenido']);
echo "
" .$row['fecha']. "";echo "
" .$row['titulo']. "";echo "
";echo "
". .$row['cabecera']. "";echo "
";echo "
";echo "
" .$row['contenido']. "";echo "
";echo "
";}
echo "
";mysql_close($con);
} else {
die();
}
?>我有相同的代碼結構,我的網頁的另一部分沒有任何問題,堅果在這種情況下,瀏覽器返回HTTP / 1.0 500內部服務器錯誤。
總結
以上是生活随笔為你收集整理的php连接mysql 500错误日志_php javascript从mysql获取数据会在服务器端产生500错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php地图找房代码,vue-baidu-
- 下一篇: Zhong__k8s基础尝试和配置fla