Re: mysql record display in table format

From: Date: Wed, 19 Jul 2000 13:20:00 +0000
Subject: Re: mysql record display in table format
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7259@lists.php.net to get a copy of this message
On Wed, 19 Jul 2000, Thomas Edison Jr. wrote: > i'm working on a code to display records from mysql in > a table format with 2 records side-by-side at a time. > ie. that records number 1 and 2 in the first row of > our HTML table and 3 and 4 in the next row and so > on... This is cut (with page specific stuff edited, hopefully not too much) from a page I have that does just that. It assumes the table is already created. <?php #set $result=mysql_query(whatever) and check for success print ("<tr>"); $i=1; while ($row = mysql_fetch_array($result)) { PRINT (" <td width='50%' valign='top'> #statements to display $row[whatever] </td> "); #two column format, add end row if multiple of 2 if ($i%2==0) print("</tr><tr>"); $i++; } ?> =============================================================================== Mr. Kelly Nicklin knicklin@ops.org Web Development/Internet Support Voice 402/557-2514 Omaha Public Schools FAX 402/557-2509 3215 Cuming St. Omaha, NE 68131

« previous php.general (#7259) next »