I am developing a site, which has a photo gallery and I know how to display results in a table top to bottom like a list, But Does anyone one to display a 3xN matrix??
Thank you
Armando
Moderator: General Moderators
Code: Select all
$output = "<table>";
for (i = 0; i < $noOfItems; $i++)
{
$output .= ($i%3==0?"<tr>":"");
$output .= "<td><img src="".$i.".jpg"></td>";
$output .= ((($i+1)%3==0)||($i==$noOfItems-1)?"</tr>":"");
}
$output .= "</table>";
echo $output;Code: Select all
$output .= ($i%3==0?"<tr>":"");