Hello,
Using it myself to...
Maybe this will help you out:

<!--BEGIN TABLE BORDER-->
<table width='90%' align='left' border='1'><tr><td>
<!--BEGIN TABLE DATA-->
<table width='90%' align='left'>
<tr><td colspan='2'align='left'>
<font color='#FFFFFF' face='Verdana' size='2'><b>blabla a headline here
</b></font></td></tr>
<tr> <!-- first <tr> for table with data -->
<?php
require ('dbconnect_includefile_with_passwd.inc');
$i=1; //this sets the counter to 1
$naam_nl = "%";
$result = mysql_query ("your query goes here to retrieve the data");
if ($row = mysql_fetch_array($result)) {
do {
   echo  "<td width='50%'>" . $row["1"] . "</td>";
   $i++; //the counter loops trough the do()while() and prints records
    if ($i==3)
    {
    echo "</tr><tr>"; //when the counter reaches 3 it prints the row-end and
new beginning.
                      //don't forget to code the <tr> for the first row
outside of the php-code
    $i=1; //sets the counter to one again and the loop starts all over
    }
  } while ($row = mysql_fetch_array($result));
  } else {print ("Sorry, no record were found.");}

?>
</tr></table>
<!--END TABLE DATA-->
</td></tr></table>
<!--END TABLE BORDER-->

Hope thsi will help.

Regards,
Bart

-----Oorspronkelijk bericht-----
Van: Jeff Oien [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 22 maart 2001 22:19
Aan: PHP
Onderwerp: [PHP] Printing MySQL into HTML Tables


I would like to do this with a MySQL database containing
product information:

<tr><td>Product 1 Info</td><td>Product 2 Info</td></tr>
<tr><td>Product 3 Info</td><td>&nbsp;</td></tr>

And if there are an odd number of products I want it to
complete the table row with nothing in the cell. I want
it to be able to automatically do this no matter how many
products there are. I'm not sure how to set it up to
print every other like that.
Jeff Oien

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to