我的网页上有一个mysql数据库和php + js + jquery页面。
在此示例中,浏览器使用以下内容加载php页面:
<script type="text/javascript">
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);
</script>
<div id="rss_rcpt">
</div>
peticion_noticia.php
<?php
$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 "<table class='PaperPage'>";
echo "<tr>";
$GLOBALS['normalizeChars'] = array(
'Á'=>'Á', 'É'=>'É', 'Í'=>'Í', 'Ó'=>'Ó', 'Ú'=>'Ú', 'Ñ'=>'Ñ',
'á'=>'á', 'é'=>'é', 'í'=>'í', 'ó'=>'ó', 'ú'=>'ú', 'ñ'=>'ñ'
);
function arregla($toClean){
return strtr($toClean, $GLOBALS['normalizeChars']);
}
while ($row = mysql_fetch_array($result)) {
arregla($row['contenido']);
echo "<td class='PaperFechaData' style='width:100px'>" .$row['fecha']. "</td>";
echo "<td class='PaperTitData' style='width:820px'>" .$row['titulo']. "</td>";
echo "</tr><tr>";
echo "<td colspan='2' class='PaperCabData' style='width:920px'>". .$row['cabecera']. "</td>";
echo "</tr><tr>";
echo "<td class='PaperImgData'><img src='".$row['img']."' width='400px' height='400px'></td>";
echo "<td class='PaperTxtData' style='width:520px'>" .$row['contenido']. "</td>";
echo "</tr>";
echo "<tr><td colspan='2'></td></tr>";
}
echo "</table>";
mysql_close($con);
} else {
die();
}
?>
我的网页的另一部分具有相同的代码结构,没有任何问题,在这种情况下,浏览器返回HTTP / 1.0 500内部服务器错误。
答案 0 :(得分:1)
echo "<td colspan='2' class='PaperCabData' style='width:920px'>". .$row['cabecera']. "</td>";
你有两个点相邻。