Hello friends.

Sorry I sent the wrong code in my last mail. Here is my correct code.

I want the output of my query to be formatted such that after every 7th output, the 
8th one should start on a new row in the table. I have written the following code but 
does not work. Can someone please help?

Quote :

<table width="800" border="0" cellspacing="0" cellpadding="3">
 <tr>
 
      <?php
   $i=0;
 while($row=mysql_fetch_array($result)){
 $i=$i+1;
 if ($i==7){
 Print "</tr><tr>";
 Print"<td width=\"150\" >";
  Print "<a href=\"findbycategory.php?"."CategoryId=".$row["CategoryId"] ."\"><font 
 color=\"#000040\" size=\"2\">$row[CategoryName]</font></a>"."   ";
 Print "</td>";
 }else{
 Print "<tr>";
 Print"<td width=\"150\" >";
  Print "<a href=\"findbycategory.php?"."CategoryId=".$row["CategoryId"] ."\"><font 
 color=\"#000040\" size=\"2\">$row[CategoryName]</font></a>"."   ";
 Print "</td>";
 if ($i==6){
 Print "</tr>";
 }}
 }
 ?>
      <div align="center">&nbsp;</div></td>
   
  </tr>
</table>

Unquote.

Thanks very much.

Denis

Reply via email to