jesse pfieffer
jesse pfieffer

Reputation: 3

Unique URL for each MySQL query

I have the below code and cant make it work to save my life. It just needs to have one of 3 links depending on which department it is from. If department = 1 then URL1.com and so on.

<?php
// Make a MySQL Connection
mysql_connect("localhost","dfasrgasdg","asdgasdgasdg") or die(mysql_error());
mysql_select_db("asdgasdgash") or die(mysql_error());


// Get all the data from the "example" table
$album = mysql_query("SELECT * FROM gallery_albums WHERE draft = 0 ORDER BY gallery_id DESC
LIMIT 0,3") 
or die(mysql_error()); 
    while($album1 = mysql_fetch_array( $album )) {


if ($album1['department_id'] == '1'); {
$albumURL = "http://ufire.sabinalcanyon.org/gallery.php?gallery_id=".$album1['gallery_id'];
}
if ($album1['department_id'] == '2'); {
$albumURL = "http://ems.sabinalcanyon.org/gallery.php?gallery_id=".$album1['gallery_id'];
}
if ($album1['department_id'] == '3'); {
$albumURL = "http://vfire.sabinalcanyon.org/gallery.php?gallery_id=".$album1['gallery_id'];
}   

echo "
<li class=\"clearfix\">
<a href=\"".$albumURL."\" class=\"thumbnail\">
<img src=\"".$album1['poster_image']."\" width=\"50\" height=\"50\" alt=\"\" />
</a>
<a href=\"".$albumURL."\" class=\"entry-title\">".$album1['title']."</a>
<div class=\"entry-excerpt\">".$album1['desc']."</div>
</li>";
}
?>

Upvotes: 0

Views: 109

Answers (1)

azngunit81
azngunit81

Reputation: 1604

u do know that you have a single '=' for comparison when you should have 2?

Upvotes: 1

Related Questions