<?php
ini_set("error_reporting",E_ALL ^ E_NOTICE);
$con = mysql_connect("127.0.0.1","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("nt", $con);
if(isset($_GET['size']))
{
$size=$_GET['size'];
}
else{$size=12;}
?>
<?php
$result = mysql_query("SELECT * FROM nt WHERE tops>=5 LIMIT 0,$size");
while($row = mysql_fetch_array($result)) //他说这里错了!!!!!!!!!!!!!!!!!!!!!!!!!!
{
?>
<div id="nt"><h2><?php echo $row['title'];?></h2>
<p><?php echo $row['content'];?></p><br>
<a href=\"pl.php?id=".$row['id']."\">评论</a></div>
<?php
}
echo "<a href=index.php?size='.($szie+6).'>更多...</a>";
mysql_close($con);
?>
ini_set("error_reporting",E_ALL ^ E_NOTICE);
$con = mysql_connect("127.0.0.1","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("nt", $con);
if(isset($_GET['size']))
{
$size=$_GET['size'];
}
else{$size=12;}
?>
<?php
$result = mysql_query("SELECT * FROM nt WHERE tops>=5 LIMIT 0,$size");
while($row = mysql_fetch_array($result)) //他说这里错了!!!!!!!!!!!!!!!!!!!!!!!!!!
{
?>
<div id="nt"><h2><?php echo $row['title'];?></h2>
<p><?php echo $row['content'];?></p><br>
<a href=\"pl.php?id=".$row['id']."\">评论</a></div>
<?php
}
echo "<a href=index.php?size='.($szie+6).'>更多...</a>";
mysql_close($con);
?>
<a href=\"pl.php?id=".$row['id']."\">评论</a></div>
改为:
<a href="pl.php?id=<?php echo $row['id'];?>">评论</a></div>
---------------------------------
echo "<a href=index.php?size='.($szie+6).'>更多...</a>";
改为:
echo "<a href='index.php?size=".($szie+6)."'>更多...</a>";
( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\index.php on line 38
照着#5改就对了