Jump to content

how to display 3 clickable images in a row from database


aadil

Recommended Posts

I want to display 3 clickable images in a single row which repeats as long as there is data in the database, so far it is displaying a single clickable image from the database. below is all the code..

 

  <table width="362" border="0">

         

        <?php   

$sql=mysql_query("select * from `publication` GROUP BY `catsue`") or die(mysql_error());

$num=mysql_num_rows($sql);

 

while($rowfor=mysql_fetch_array($sql))

{

 

 

$cat=$rowfor['catsue'];

$pic=mysql_query("select * from `category` where `catsue`='$cat'") or die(mysql_error());

$picP=mysql_fetch_array($pic);

$base=basename($picP['title']);

?>

<tr>

              <td width="352" height="88"><table width="408" border="0">

                <tr>

                  <td width="113" rowspan="5"><a href="archive_detail.php?id=<?php echo $rowfor['id'];?>&category=<?php echo $rowfor['catsue'];?>"><img src="ad/pic/<?php echo $base;?>" width="100" height="100" border="0"/></a></td>

                  <td width="94">Title</td>

                  <td width="179" height="1"><?php echo $rowfor['catsue'];?> </td>

                </tr>

                <tr>

                  <td> </td>

                  <td width="179" height="3"> </td>

                </tr>

                <tr>

                  <td> </td>

                  <td width="179" height="8"> </td>

                </tr>

                <tr>

                  <td> </td>

                  <td width="179" height="17"> </td>

                </tr>

                <tr>

                  <td> </td>

                  <td width="179" height="36"> </td>

                </tr>

              </table></td>

              </tr>

              <?php

 

}?>

         

          </table>

Are you always going to display only three or do you mean an unknown number of pictures in a three column layout?

If it's the last one you need a counter for how many pictures you already displayed plus a last line to be padded if you run out of pictures.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.