我有以下代码,并且无法使其工作以挽救我的生命。它只需要有3个链接中的一个,具体取决于它来自哪个部门。如果department = 1则为URL1.com,依此类推。
<?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>";
}
?>
答案 0 :(得分:1)
你知道你有一个'='用于比较,你应该有2?