if / elseif in Loop - SOLVED
Posted: Tue Aug 29, 2006 3:15 pm
My if /elseif statement does not work properly in the while loop. Can someone explain why?
Code: Select all
<?php
include 'includes/connect.php';
$query = "SELECT * FROM article, image WHERE article.a_id=image.a_id ORDER BY article.a_id DESC";
$result = mysql_query($query) or die('Error : ' . mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$a_id = $row['a_id'];
$title = $row['title'];
$abstract = $row['abstract'];
$date = $row['date'];
$path = $row['path'];
$iurl = $row['iurl'];
$none = $row['none'];
$organize = $row['organize'];
$date = date("F d Y");
$content = '<div id="entry">';
if (path == TRUE) {
$content .= '<img class="entry" src="' . $path . '" width="150" align="right">';
} elseif (iurl == TRUE) {
$content .= '<img class="entry" src="' . $iurl . '" width="150" align="right">';
}
$content .= '<div id="entry-copy">';
more $content......
echo $content;
}
mysql_close();
?>