Hello,
I am trying to display a HTML table of 2 cells with "n" elements... This means
an unknown number of lines.
I need to use 2 FOR loops (one to determine the number of <TR> and one to
create the 2 cells needed). This is a bit to overwellming for me...
I have:
$result = connect_db("select prod_id,photo from prod where cat_id=1");
$Rows = pg_NumRows($result);
$lines_TOT = ceil($Rows/2);
for($TR=0; $TR < $ligne_TOT; $TR++){
print "<tr>\n";
for($TD=0; $TD < 2;$TD++){
$photo=pg_Result($result,$TD,photo);
$prod_id=pg_Result($result,$TD,prod_id);
print "<td>";
if ($prod_id != ""){
print "<img src=\"../photo/". $photo. "s.jpg\" border=0>\n";
} else {
print " ";
}
print "</td>";
}
}
As you can see, the second loop cant continue to display the next product... So
the first line with the 2 images are ok but the other lines are identical, so
if I have 10 products, I see only 1 and 2 over 5 lines!
How can I solve this? To have 2 columns per line, I must limit the loop but I
need to continue at that point on the second line...
Thank you for any assistance!
--
Marc Andr� Paquin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php