I'd like to know why this while loop is wrong and how to correct it. while($offst < $rws2) { $sq2 = "Select FROM artsub WHERE artistid = '$aid' LIMIT $offst, 1"; $rest2 = mysql_query($sq2); $r = mysql_fetch_object($rest2); $ct = $r->category; $sq3 = "SELECT FROM artsub WHERE category = '$ct'"; $rest3 = mysql_query($sq3); $rws2 = mysql_num_rows($rest3); echo $rws2; $offst = $rws2; $offst++; }
It sounds odd that this would be an infinate loop, because in the first iteration, the condition is met:
$offst = $rws2; $offst++;
this means that $offst >$rws2 and the loop should stop.
It certainly is odd. But apparently it is a problem for my web host because they shut my web site down every time it happens.