PHP While() Stop Looping
- by Axel
Hi,
i have a php loop which displays only one record even if there is hundreds.
here is the code:
<?php
$result1 = mysql_query("SELECT * FROM posts") or die(mysql_error());
$numexem = mysql_num_rows($result1);
$s="0";
while($s<$numexem){
$postid=mysql_result($result1,$s,"id");
echo "Post id:".$postid;
$result2 = mysql_query("SELECT * FROM pics WHERE postid='$postid'") or die(mysql_error());
$rows = mysql_fetch_array($result2) or die(mysql_error());
$pnum = mysql_num_rows($result2);
echo " There is ".$pnum." Attached Pictures";
$s++;
}
?>
I'm wondering if the loop stop because there is other SQL query inside it or what?
and i don't think so.
Thanks