You can do what he said or just put a separate loop inside the original
loop.

Depending on how you get the info, you can use either way (his would create
less overhead if you are just using the same <TD> info every row, otherwise
they're really the same because his way you'll have to create an array to
access later for multiple rows, or just do my way and have the loop access
the NEXT *3* (or whatever) items ...).

i.e.,
for (LOOP FOR <TR>)
{
    for (LOOP FOR <TD>) {}
}

"CÚsar aracena" <[EMAIL PROTECTED]> wrote in message
001a01c234f0$a5e8ad80$28ed0dd1@gateway">news:001a01c234f0$a5e8ad80$28ed0dd1@gateway...
Hi all.

Last nite I've came across a problem I wasn't able to figure out by my
self. It's 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:[EMAIL PROTECTED]> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to