RE: [PHP] Newbie question about filling tables.

From: Date: Wed, 22 Nov 2000 16:58:35 +0000
Subject: RE: [PHP] Newbie question about filling tables.
Groups: php.general 
Request: Send a blank email to php-general+get-26666@lists.php.net to get a copy of this message
O.k. I see what you're trying to do. You want record 1 in row 1 col1 and record 2 in row 1 col 3. Basically two records per row. The only thing i can think of then is to while($i=mysql_fetch_array($query)) { print "<TR><TD WIDTH="245" VALIGN="MIDDLE">$Record Name<P>$Some_More_Record_Stuff</P></TD>"; $i=mysql_fetch_array($query); print "<TD WIDHT="245 VALIGN="MIDDLE">$Record Name<P>$Some_More_Record_Stuff</P></TD>"; print "</TR> } print "</TABLE>" You however have to address what happens if the second fetch_array is statement is empty. Hope this helps. Mike -----Original Message----- From: Angel Behar Rodriguez [mailto:abehar@mail.pacificnet.com.mx] Sent: Wednesday, November 22, 2000 11:48 AM To: Krznaric Michael Cc: php-general@lists.php.net Subject: RE: [PHP] Newbie question about filling tables. First of all, thanks for your answer. I already try the way you told me, but my problem is when I try to fill the cells in the second column everything becomes a mess, I mean the first record prints in the cell of row 1 column 1 the second record fills the row 1 COLUMN 2, the 3rd record prints the row 2 column 1 and so on. Hope this help for an overview of the problem. thanks in advance. P.S. Sorry abou my english --------------------------------------------------------------------------- Ing. Angel Behar R. | "The box says : Windows 98, Windows NT or BETTER Tel : (67) 15-15-15 | That's why I installed FreeBSD" --------------------------------------------------------------------------- On Wed, 22 Nov 2000, Krznaric Michael wrote: > Just put echo or print statement around what you have listed below. > print "<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" > WIDTH="491" > HEIGHT="200">"; > > while($i=mysql_fetch_array($query)) { > print "<TR><TD WIDTH="245" VALIGN="MIDDLE">$Record > Name<P>$Some_More_Record_Stuff</P></TD></TR>"; > } > print "</TABLE>" > > This should give you an idea. > > Mike > -----Original Message----- > From: Angel Behar Rodriguez [mailto:abehar@mail.pacificnet.com.mx] > Sent: Wednesday, November 22, 2000 11:01 AM > To: php-general@lists.php.net > Subject: [PHP] Newbie question about filling tables. > > > > Hi, Im running php 4.0.3pl1 in a linux 6.2 box, and I'm trying to "fill" a > two column x five row table with a different record each cell, I don't > have too much experience with php programming, so I can make the MySql > query and fetch the results, but once I start the > while($i=mysql_fetch_array($query)) command then > I dont' know how to display each record in the cell, hope somebody can > help me or give me some ideas. > > Thanks in advance. > > The General idea is the following : > > <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" > WIDTH="491" > HEIGHT="200"> > <TR> > <TD WIDTH="245" VALIGN="MIDDLE">Record 1 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > <TD WIDTH="4" VALIGN="MIDDLE"></TD> > <TD WIDTH="242" VALIGN="MIDDLE">Record 2 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > </TR> > <TR> > <TD WIDTH="245" VALIGN="MIDDLE">Record 3 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > <TD WIDTH="4" VALIGN="MIDDLE"></TD> > <TD WIDTH="242" VALIGN="MIDDLE">Record 4 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > </TR> > <TR> > <TD WIDTH="245" VALIGN="MIDDLE">Record 5 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > <TD WIDTH="4" VALIGN="MIDDLE"></TD> > <TD WIDTH="242" VALIGN="MIDDLE">Record 6 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > </TR> > <TR> > <TD WIDTH="245" VALIGN="MIDDLE">Record 7 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > <TD WIDTH="4" VALIGN="MIDDLE"></TD> > <TD WIDTH="242" VALIGN="MIDDLE">Record 8 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > </TR> > <TR> > <TD WIDTH="245" VALIGN="MIDDLE">Record 9 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > <TD WIDTH="4" VALIGN="MIDDLE"></TD> > <TD WIDTH="242" VALIGN="MIDDLE">Record 10 > <p>$var1 ; $var2, $var3&nbsp;</p> > </TD> > </TR> > </TABLE> > > > --------------------------------------------------------------------------- > Ing. Angel Behar R. | "The box says : Windows 98, Windows NT or BETTER > > Tel : (67) 15-15-15 | That's why I installed FreeBSD" > --------------------------------------------------------------------------- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#26666) next »