RobertSubnet Posted August 1, 2009 Share Posted August 1, 2009 Hello all. I am trying to use a while loop to populate a table with pictures and a short description under the pictures. It should look something like this: pic1 pic2 pic3 text text text pic4 pic5 pic6 text text text etc. I am using PHP and MySQL to get the pictures and text data. The tricky part is getting the table populated correctly. What I currently have looks like this: pic1 pic1 pic1 text text text pic2 pic2 pic2 text text text etc. I understand why the first row is all the same picture. What I don't know is how to get pic1, pic2, pic3 on the first row. Here is my code: while ($row = mysql_fetch_array($gallery_query_result)) { $photo1 = $row['photo1']; echo "<table>"; echo "<tr><td>"; echo "<img src = $photo1 /><br/>"; echo "short description"; echo "</td><td>"; echo "<img src = $photo1 /><br/>"; echo "short description"; echo "</td><td>"; echo "<img src = $photo1 /><br/>"; echo "short description"; echo "</td></tr>"; echo "</table>"; //close while loop } Is a table not the best way to output the pictures and text? Any suggestions would be much appreciated. Thanks!! Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 1, 2009 Share Posted August 1, 2009 Have a look at this FAQ Snippet. Quote Link to comment Share on other sites More sharing options...
RobertSubnet Posted August 1, 2009 Author Share Posted August 1, 2009 Wildteen: Thanks! ~Robert Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.