RE: [PHP] Table Making

From: Date: Thu, 11 Jul 2002 06:34:15 +0000
Subject: RE: [PHP] Table Making
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107032@lists.php.net to get a copy of this message
Thanks for the code improvement, but that will still print results from left to right, top to bottom, i.e. the items ascend left to right in the rows. I'm not concerned with the actual order that they come out of MySQL in, just how they're displayed. Basically, instead of this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 I want this: 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 Thanks again for the help, though. Jason Soza -----Original Message----- From: Analysis & Solutions [mailto:danielc@analysisandsolutions.com] Sent: Wednesday, July 10, 2002 10:13 PM To: PHP List Subject: Re: [PHP] Table Making Jason: On Wed, Jul 10, 2002 at 10:04:45PM -0800, Jason Soza wrote: > > I have this nice piece of code to take my SQL result and organize it into a > nice 5 column table: Nice is in the eye of the beholder... Here's what I think is nice: echo "<table width=\"100%\" border=\"0\" align=\"center\">\n"; echo " <tr>\n"; while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) { echo ' <td align="center"><a href="year.asp?year='; echo $row['grad_year'] . '">' . $row['grad_year'] . "</a></td>\n"; } echo " </tr>\n"; echo "</table>\n\n"; If you want to reverse the order, use an ORDER BY clause in your query string. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

« previous php.general (#107032) next »