Re: mysql table layout help needed

From: Date: Thu, 20 Dec 2001 22:20:07 +0000
Subject: Re: mysql table layout help needed
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15168@lists.php.net to get a copy of this message
A sample of what you were trying would have been helpful... If I understood your problem right, the solution is a piece of code like this: <? echo("<table>\n<tr>\n"); while ($myrow=mysql_fetch_row($result)) { $colcount++; if ($colcount==$desiredcolcount) { $colcount=0; } if (!$colcount) { echo("</tr>\n<tr>\n"); } echo("<td>[your output here]</td>\n"); } if ($colcount) { for (;$colcount<$desiredcolcount;$colcount++) { echo("<td>&nbsp;</td>\n"); } } echo("</tr>\n</table>"); ?> Chris Payne wrote: > Hi there everyone, > > This is probably a really simple problem but for the life of me I can't figure out what > i'm doing wrong. > > My problem is I am getting 20+ results from a DB to display without any problems with the > images etc ..... but they display one ontop of another (Of course with spacing underneath etc ...) > The problem however is that when I try to format the layout in a table it screws up. > > I need the results to display 3 across and however many down as needed, but I can only get it > to display either one ontop of the other or all of them going across the top of the screen which > stretches the screen out unacceptably. > > Please help me, I need to know how the table code should be to allow me to display 2 or 3 items > across and then down. > > Thank you all for your help and Merry Christmas :-) > > Chris

« previous php.db (#15168) next »