function show_books($cid, $host, $php_self) { $q = "select * from books where category = '".$cid."'"; $r = mysql_query($q) or die(mysql_error()); echo ''; $tmp = 1; while ($book=mysql_fetch_array($r)) { if ($tmp = 1) echo ''; echo''; if ($tmp = 2) { echo ''; $tmp = 0; } $tmp++; } echo '
'.$book['title'].'
'; }