Hello every body,
I made an image gallery, but the photos displaying repeatedly in each row, I want the seven pictures displaying in each row of the table, then starts from the other row and same for others, the attachment pictures show the problems, what should I do?

<?php
$select = mysql_query("SELECT * FROM gallery ORDER BY id DESC") or die(mysql_error());
    echo "<table align=center>";
    while($r = mysql_fetch_array($select)){
       // extract($r);
    $pic = $r['image'];
    $pic = "UploadedImage/".$pic;
    $id = $r['id'];
        ?>
        <tr>
            <td align="center"><b><?php print($r['title']); ?></b></td>
            <td align="center"><b><?php print($r['title']); ?></b></td>
   <td align="center"><b><?php print($r['title']); ?></b></td>
            <td align="center"><b><?php print($r['title']); ?></b></td>
            <td align="center"><b><?php print($r['title']); ?></b></td>
   <td align="center"><b><?php print($r['title']); ?></b></td>
   <td align="center"><b><?php print($r['title']); ?></b></td>
        </tr>
  
  <tr>
            <td align="center"><?php print($r['description']); ?></td>
            <td align="center"><?php print($r['description']); ?></td>
   <td align="center"><?php print($r['description']); ?></td>
            <td align="center"><?php print($r['description']); ?></td>
            <td align="center"><?php print($r['description']); ?></td>
   <td align="center"><?php print($r['description']); ?></td>
            <td align="center"><?php print($r['description']); ?></td>
        </tr>
  
  <tr>
            <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
            <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
   <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
            <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
            <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
   <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
            <td align="center"><?php print("<img width=150 height=150 src='$pic'>"); ?></td>
        </tr>
  
  <tr>
            <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
   <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
   <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=edit&amp;id=$id\">Edit</a>"); ?></td>
        </tr>
  
  <tr>
            <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>  
            <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>
   <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>
   <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>
            <td align="center"><?php print("<a href=\"admin.php?action=delete&amp;id=$id\">Delete</a>"); ?></td>
        </tr>
  
  <tr>
            <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>  
            <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>
   <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>
            <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>
            <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>
   <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>
            <td align="center"><?php print("<a href=\"full.php?id=$id\">Full Image</a>"); ?></td>
        </tr>
  
        <?php
    }
    echo "</table>";
    ?>

Recommended Answers

All 6 Replies

you have your php code set up wrong. i tried putting to problem into words but couldn't. you have use the while statement incorrectly. i will provide the code to display the images right in alittle while. i can't right now because of my location. someone else might have a solution for you before the code is finished.

Member Avatar for fatihpiristine

your code is totaly wrong.. u ve to while and for or for and for circle one after each other..

i wrote this one for someone ...few months ago...

it is originally set to 4 column right and 4 row down...

you can extend it as much as you want... but you have to clean it a bit...

Thanks much for the code, I will go through this and will post again...Thanks again

Mr. fatihpiristine, Thanks much for the code,

I am not so expert in PHP, may I request you kindly, change the above attachment code "RTL-Down.zip" according to my problem, I know it is more expext, but request you...Thanks

Member Avatar for fatihpiristine

how many rows and columns you want on the page?
what about size of the images ??

how many rows and columns you want on the page?
what about size of the images ??

I need 7 columns and dynamic rows on the page, if pagination is possible then I need 7 columns and 4 rows per page...

Size of the image should be like thumbnail (about 150 x 150)

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.