I have this code, if the number of rows is a square root of 3 (the number of columns I want displayed, then everything is fine. But if it is not, then my footer (bottom.php) is not displayed. Can anyone help?
$kind = $HTTP_GET_VARS['kind'];
$query = mysql_query("SELECT * FROM auto WHERE kind='$kind'") or die(mysql_error());
$num=mysql_num_rows($query) or die(mysql_error());
$i=0;
While($i<$num)
{
$cols = 0;
$root = sqrt($cols);
while($cols!=3) {
$row = mysql_fetch_array($query) or die(mysql_error());
$link = $row['stockid'];
$year = $row['year'];
$make = $row['make'];
$model = $row['model'];
$image = $row['image'];
echo "<td><a href='show.php?stockid=$link'><img src='$kind/$image' width='250'
height='100'><br> $year $make $model </a></td>";
$cols++;
$i++;
} if($root == 3){ } else{ echo "</tr><tr>";
}
}
Thanks!