php while loop throwing a error over a $var < 10 statement
- by William
Okay, so for some reason this is giving me a error as seen here: http://prime.programming-designs.com/test_forum/viewboard.php?board=0
However if I take away the '&& $cur_row < 10' it works fine. Why is the '&& $cur_row < 10' causing me a problem?
$sql_result = mysql_query("SELECT post, name, trip, Thread FROM (SELECT MIN(ID) AS min_id, MAX(ID) AS max_id, MAX(Date) AS max_date FROM test_posts GROUP BY Thread ) t_min_max INNER JOIN test_posts ON test_posts.ID = t_min_max.min_id WHERE Board=".$board." ORDER BY max_date DESC", $db);
$num_rows = mysql_num_rows($sql_result);
$cur_row = 0;
while($row = mysql_fetch_row($sql_result) && $cur_row < 10)
{
$sql_max_post_query = mysql_query("SELECT ID FROM test_posts WHERE Thread=".$row[3]."");
$post_num = mysql_num_rows($sql_max_post_query);
$post_num--;
$cur_row++;
echo''.$cur_row.'<br/>';
echo'<div class="postbox"><h4>'.$row[1].'['.$row[2].']</h4><hr />' .$row[0]. '<br /><hr />[<a href="http://prime.programming-designs.com/test_forum/viewthread.php?thread='.$row[3].'">Reply</a>] '.$post_num.' posts omitted.</div>';
}