Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Creating a table 1

Status
Not open for further replies.

shamrox

Programmer
Sep 27, 2001
81
US
Ok, I have a database table with all the image file names, I want to be able to output the images into a table listing them across and then creating the next row, kind of like an image catalog.
I am using DW and can only get the repeat region to creat a new table listing all the images down the page instead of across and then down.
Does anyone know how I'd code this to creat what I want.
BTW, using PHP/MySql

thanks.

 
More of a PHP issue. Decide the maximum number of pictures for one row

Code:
// code for selecting and binding
echo &quot;<table>&quot;;
$p = 0;
$pperrow = 10;
while (row = mysql_fetch_row($c)) {
   if  ( $p == 0 ) {
        echo &quot;<tr>&quot;;
   }
   echo &quot;<td>&quot; & row[0] & &quot;</td>&quot;;
   $p++;
   if ($p == $pperrow ) {
       echo &quot;</tr>&quot;;
       $p= 0;
    }
}
if ( $p != 0 ) echo &quot;</tr>&quot;;
echo &quot;</table>&quot;;

Untested, but in principle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top