1. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    London, UK
    Rep Power
    I have a PHP program that first of all, assigns an ID number to an image, then uploads the image into a directory on the server and gives it the ID number as a name (for example, 365912546.gif) and finally adds a database record containing the image ID number and the time the image is added. I then want to have a program that retrieves the images and prints them in an HTML table. But, here's the catch: I want there to be four images on each table row. So, the process that retrieves the images and puts them in a table would run four times, then restart. I've no idea how to do this at all: hopefully someone reading this does! Please help me out if you can.

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Rep Power
    Do you mean that there would be four cells to each row across? This is how I do it and it wprks great
    //Set this to be the number you want across
    $rows = 4;
    $i = 1;
    print '<table><tr>';
    while ($row = mysql_fetch_array($result)) {
    if (is_int($i / $rows)) {
    print '<td><img src="'. $row["imagefield"] .'"></td></tr><tr>';
    else {
    print '<td><img src="'. $row["imagefield"] .'"></td>';
    print '</tr></table>';

Similar Threads

  1. Query for Retrieving Results on a Quartely basis
    By srinig2002 in forum Database Management
    Replies: 1
    Last Post: February 6th, 2004, 03:39 PM
  2. (mysql) retrieving 1 row instead of 40 rows
    By ol4pr0 in forum PHP Development
    Replies: 8
    Last Post: January 30th, 2004, 03:22 PM
  3. limit mysql display results into 3 table rows
    By bcounsell in forum MySQL Help
    Replies: 1
    Last Post: January 9th, 2004, 07:16 AM
  4. Limit results on 'left join' query
    By tippiedog in forum MySQL Help
    Replies: 1
    Last Post: November 12th, 2003, 07:58 AM
  5. Query Results and affected rows?
    By MrSlappyPants in forum PHP Development
    Replies: 2
    Last Post: October 24th, 2003, 09:04 PM

IMN logo majestic logo threadwatch logo seochat tools logo