>
> my improvement is:
> ===============
> $counter = 1;
> echo "<table border=1><tr>"; //start of table
> for ($i=0;$i<$num_rows; $i++) //loop through the number of records
> {
>       $row = mysql_fetch_array($result); //Get associate row
>       echo "<td>$row[0]</td>";  //Print out the NAME
>       if($counter =(! $counter)) echo "</tr><tr>"; //Make a new Table row
> }     
> echo "</tr></table>";
> ================
> Terry
>
> On Thursday, September 5, 2002, at 06:39  PM, Brad Bonkoski wrote:
>
>> How's this? (MYSQL example)
>>
>> $query = "select NAME from table_name";
>> $result = mysql_query($query)
>> or die("Invalid Query: $query");
>>
>> $num_rows = mysql_num_rows($result);
>> $counter=1;
>> echo "<table border=1><tr>"; //start of table
>> for ($i=0;$i<$num_rows; $i++) //loop through the number of records
>> {
>>      $row = mysql_fetch_array($result); //Get associate row
>>      echo "<td>$row[0]</td>";  //Print out the NAME
>>      if ($counter == 2)
>>      {
>>              echo "</tr><tr>"; //Make a new Table row
>>              $counter=1;       //Reset Counter       
>>      }
>>      else
>>      {
>>              $counter++; //Just increment the counter
>>      }
>> }
>> echo "</tr></table>";
>> mysql_free_result($result);
>>
>> HTH
>>
>> -Brad
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to