I'm having trouble writing a script that displays images on a page and also using mySQL.
When a user uploads a photo, the photo URL, file size, and name are stored in a database. The max number of photos is 9.
What I want to do is display the photos on a page - 3 images per row, and a max of 3 rows which will display 9 images. But if the person only uploaded 7, I want only 7 images to show up.
my code so far is this..
// this tells me how many photos are stored with a specific user (0-9)
$rows = mysql_query("SELECT FROM table WHERE userid='$userid'");
$mqpn = mysql_query("SELECT photoname FROM table WHERE userid='$userid'");
$mqpi = mysql_query("SELECT photoid FROM table WHERE userid='$userid'");
Now above each photo I want a text link to delete the photo, and below the photo I want to list the photo ID number and name.
so I would need an increasing variable in a while statement I'm assuming to display the mysql_result of each..
$photoname = mysql_result($mqpn, $i);
$photoid = mysql_result($mqpi, $i);
So each output should have 4 lines (delete link, photo, photo name, photo id) using a table.
Kind of like this
echo "<tr><td align=\"center\">[ <a href=\"http://domain.com/" . $scdirn . "/edit_image.php?SID=" . $SID . "&PID=" . mysql_result($queryid,0) . "\">EDIT</a> | <a href=\"http://domain.com/" . $scdirn . "/delete_image.php?SID=" . $SID . "&PID=" . mysql_result($queryid,0) . "\">DELETE</a> ]</td></tr>";
echo "<tr><td align=\"center\"><img src=\"" . mysql_result($queryurl,0) . "\" width=\"125\" border=\"0\" alt=\"\"></td></tr>";
echo "<tr><td align=\"center\">Photo Name " . mysql_result($querynm,0) . "</td></tr>";
echo "<tr><td align=\"center\">Photo ID# " . mysql_result($queryid,0) . "</td></tr>";