Gem Posted May 21, 2010 Share Posted May 21, 2010 hey up peeps! I'm building a photo gallery. Ive done the upload bit, but im struggling with displaying the albums, Basically I want the album thumbnail to display in a table. I can do that, but what i cant do is 2 columns ... ie. a table with 2 columns, multiple rows depending on how many albums there are... Heres the code I have so far so you know what im on about ... <?php include ("includes/dbconnect120-gem.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table> <tr><th>Album Name</th><th>Album Cover</th></tr> <?php //Get album + Thumbnail $sql="select a.album_id, a.album_name, u.thumbpath from album a left join upload u on u.album_id=a.album_id GROUP BY a.album_id"; $result=mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $aid=$row['album_id']; $aname=$row['album_name']; $thumb=$row['thumbpath']; //table echo "<tr><td>"; echo $aname; echo "</td><td>"; echo '<img src="'.$thumb.'" />'; echo "</td></tr>"; } echo "</table>"; //table 1 ?> </body> </html> And heres what I want ... =============================== | Album name | Album name | | --------------- | ------------------ | | | | | | | | | | | | | | | | | | | | | | | --------------- | ------------------ | |============================== | Album name | Album name | | --------------- | ------------------ | | | | | | | | | | | | | | | | | | | | | | | --------------- | ------------------ | ============================== | Album name | Album name | | --------------- | ------------------ | | | | | | | | | | | | | | | | | | | | | | | --------------- | ------------------ | =============================== etc etc Link to comment https://forums.phpfreaks.com/topic/202515-tables-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.