Trouble programming my own photo gallery
Posted: Fri Apr 09, 2010 6:21 pm
I originally started out by reading PHP/Mysql for dummies and doing many online tutorials and still cannot seem to program my own code that works.
So I have two pages:
photo.php - which calls on the album thumbnails and seems to work successfully. Although, I believe I am using amateur coding.
viewAlbum.php - this is the one I am having trouble on. I have used a ton of different ways to write the code and some seem to somewhat work, others do not.
My problem is I cannot have album 1 always showing on all links.
How do I make just the album the user clicked on display?
Also, does any one know how to get the lightbox to work?
That also doesnt work.
Thanks for the time,
Brian
So I have two pages:
photo.php - which calls on the album thumbnails and seems to work successfully. Although, I believe I am using amateur coding.
Code: Select all
$con = mysql_connect("...","...","...");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("...", $con);
$result = mysql_query("SELECT * FROM photo_albums ORDER BY uptime DESC");
while($row = mysql_fetch_array($result))
{
echo '<div class="photoThumb">';
echo '<a href="viewAlbum.php?aid='.$row['aid'].'"><img src="' . $row['filepath'];
echo $row['filename'] . '"';
echo 'border="0" /></a>';
echo '<br/>';
echo '<span class="thumbText"><a href="viewAlbum.php?aid='.$row['aid'].'">' . $row['stitle'];
echo '</a><br/>';
echo $row['photog'];
echo '</span>';
echo "</div>";
}
mysql_close($con);
Code: Select all
$con = mysql_connect("...","...","...");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("...", $con);
$result = mysql_query("SELECT *
FROM `pictures` WHERE `aid` = 1 ORDER BY `pid` ASC");
while($row = mysql_fetch_array($result))
{
echo '<div class="photoThumb">';
echo '<a href="';
echo $row['filepath'];
echo $row['filename'];
echo '"><img src="';
echo $row['filepath'];
echo $row['filename'];
echo '" rel="lightbox[' .$row['aid'];
echo ']" border="0" width="100px" /></a><br/>';
echo "</div>";
}
mysql_close($con);
How do I make just the album the user clicked on display?
Also, does any one know how to get the lightbox to work?
Code: Select all
echo '" rel="lightbox[' .$row['aid'];Thanks for the time,
Brian