Hi, i need help , i wanted images to be for instance 4 in row, before it goes on to the next row, and below the images i wanted a title there.

This are my work so far, but i just cant get to what I wanted, i've been searching for days, please help ):

<?php
	  $displayPhoto = "";
	
      $a = 0;
	  while($row = mysql_fetch_array($result)){
			$a++;
			$displayPhoto .= "<tr><img src='image/".$row['image']."' height=200px width=200px /></tr>"."<tr>".$row['title']."</tr>";
		
			if (($a%4) == 0){
			$displayPhoto .="<br/><br/>";
		
			}
			 }
			 echo $displayPhoto;
             ?>

and

<?php
	  $displayPhoto = "";
	  $displayBrand = "";
      $a = 0;
	  while($row = mysql_fetch_array($result)){


              ?><p>&nbsp;</p>
           	 <table width="168" border="0" align="center">

                         <tr>
                              <td><img src="image/<?php echo $row['image']; ?>" width="133" height="180" /></td>          </tr>
                          </tr>
                          <tr>

                               </tr>
                          <tr>
                              <td><div align="center"><span class="style6">Brand: <?php echo $row['brand']; ?></span></div></td>
                          </tr>
                          </table>          <p>&nbsp;</p></td>
                            </tr><tr bgcolor="#6699FF"><td height="20" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
                            </tr>
                           <p>
 <?php	} ?>

Recommended Answers

All 5 Replies

i've tried, but i don't understand why is my if statement underlined ):

i got it ! however how can i place the title under each of the images?

<?php
      $count = 0;
	  while($row = mysql_fetch_array($result)){
                 if ($count % 4 == 0)
                     echo '<tr>';
                 echo "<td><img src='image/".$row['image']."' height=200px width=200px /></td>";
                    if ($count % 4 == 3)
                     echo '</tr>';
                 $count++;  }
             ?>

Add it after the image.

OMG AWESOME!
I didnt thought of adding beside it, i tried putting under and after <tr>

Thank you sooooo much pritaeas !
Really thanks so much

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.