PHP使用limit的问题
$sql="selectnamefrommoviesorderbyiddesclimit0,10";$get=mysql_query($sql);$resul=mysql...
$sql = "select name from movies order by id desc limit 0,10";
$get = mysql_query($sql);
$resul = mysql_fetch_array($get);
for($x = 0;$x <10;$x++)
{
$sql = "select id from movies where name = '$resul[$x]'";
$got = mysql_query($sql);
$result = mysql_fetch_array($got);
echo "<script>alert('$x'+'$resul[$x]')</script>";
echo "<p><a href='watch.php?id=$result[0]'>$resul[$x]</a></p>";
}
这样子在数据库里明明有两条,但是只输出了最后的一条,后面的都是空白 展开
$get = mysql_query($sql);
$resul = mysql_fetch_array($get);
for($x = 0;$x <10;$x++)
{
$sql = "select id from movies where name = '$resul[$x]'";
$got = mysql_query($sql);
$result = mysql_fetch_array($got);
echo "<script>alert('$x'+'$resul[$x]')</script>";
echo "<p><a href='watch.php?id=$result[0]'>$resul[$x]</a></p>";
}
这样子在数据库里明明有两条,但是只输出了最后的一条,后面的都是空白 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询