Jump to content

Tables - Code help please?


Gem

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.