Table formatting
| From: | César Aracena | Date: | Fri, 26 Jul 2002 22:05:53 +0000 |
| Subject: | Table formatting | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109891@lists.php.net to get a copy of this message | ||
Hi all.
Last nite Ive came across a problem I wasnt able to figure out by my
self. Its not difficult to make a loop that will make new *TABLE ROWS*
(<tr>) to show several DB objects in a nice way
what I need to do, is
to display 2 or maybe even 3 of this objects stored in a DB per table
row, separated in different *TABLE COLUMS* (<td>)
how can I achieve
this? What I usually do is:
------------------------------
// DB QUERY
$query = SELECT * FROM table_name;
$result = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($result);
// NOW THE LOOP
for ($i=0; $i<$num_rows; $i++)
{
$row = mysql_fetch_array($result);
echo <tr>;
echo <td>;
echo $row[whatever];
echo </td>;
echo </tr>;
}
------------------------------
but how can I get 2 or 3 columns displaying different db objects? A loop
inside a loop?
Thanks in advance,
<mailto:webmaster@icaam.com.ar> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621