I have code that I want to take only the first image of a gallery and display it for a link to the full gallery
here is the link to the page
http://www.parkersawyer.com/test/gallery.php
as you can see it shows each image in the gallery for that album
I want it to show only the first image for gallery 1,2,3 and so on
like on kodakgallery.com
the table structure is as follows
albums
id
album_id
name
create_date
images
id
album_id
paths
I think my query needs a little tweaking.
Here is the code so far
$query = "select a.name, a.create_date, a.album_id, i.paths from albums a inner join images i on a.album_id = i.album_id";
$result = mysql_db_query ($DBName, $query, $Link);
$col = 1;
?>
</head>
<body>
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center" valign="middle">
<td>
<table width=100% height=80 border=0 cellspacing=0 cellpadding=0 align=center class=category_style>
<tbody>
<tr>
<td> </td>
</tr>
<tr>
<?php
while($row = mysql_fetch_array($result)) {
$id = $row['album_id'];
$name = $row['name'];
$paths = $row['paths'];
$output .= "
<td>
<div class=recentalbum>
<span class=albumlink-span>
<a class=albumlink href=/test/view_gallery.php?album_num=$id>
<img class=shim src=albumshim.gif alt= /><img src=./thumb.php?src=/test/images/$paths&w=100&q=99 border=0></a>
</span>
<a href=/test/view_gallery.php?album_num=$id>$name</a>
$row[create_date]
</div>
</td>";
if ($col % 5 == 0) {
$output .= "</tr><tr><td> </td></tr><tr>";
$col = 0;
}
$col++;
}
echo $output;
?>
<td align=center>
</td>
</tr>
<tr>
<td align=center> </td>
</tr>
</tbody>
</table>
</td>
</body>
</html>