Forum Moderators: coopster
function film_menu ($yes_other, $no_other, $menu_head, $film) {$query = "SELECT * FROM items WHERE $yes_other $no_other ORDER BY date DESC LIMIT 4";
$result = mysql_query($query);echo "$menu_head<br><span class=\"head\">$film</span><br> <br>";
while($row = mysql_fetch_assoc($result)) {
[b]if(empty($row)){
return None;
}[/b]
else if(empty($row['theme02'])) {
$themes = "{$row['theme01']}";
}
else {
$themes = "{$row['theme01']} {$row['theme02']}";
}
echo "
<div class=\"filminfo\"><a href=\"film_film.php?p={$row['link']}\";>{$row['title']}</a><br>
$themes<br>{$row['rating']} - {$row['length']}wds - <a href=\"reviews/view.php?id={$row['item_id']}\">reviews</a><br>{$row['summary']}</div>";
}}
I've tried empty($query) and empty($result) neither work but both work when used with,!empty. What's happening!? I've moved the If statement around in case it's in the wrong place, but the thing just won't work.
I give up!
then you could test the number of returned rows before you get to your while loop. You could do something like
$numrows = mysql_num_rows($result);
if($numrows < 1){
return None;
}
while($row = mysql_fetch_assoc($result)) {
jatar_k, I can't tell you how much I thank you. :D The problem was giving me such a headache!
This is the first function I've ever written, last night I was so happy when it all worked, :D , but my euphoria was short lived. Just when you get over one php hill, there's a bigger one on the horizon. lol