I got the following code:
if(isset($_SESSION['user_id'])) { $query = "SELECT * FROM watchlist,movies WHERE watchlist.page=movies.id AND userid=". $_SESSION['user_id'];
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while( $row = mysql_fetch_assoc($result) )
{
echo '<div id="watchlist">';
echo '<a href="watch.php?id='.$row['page'].'"><img src="http://nocmmnt.com/posters/'.$row['imdb_id'].'.jpg" height="217" width="154"></a><br>';
echo '<span style="float:right;"><a href="delete.php?wid='.$row['wid'].'"><img src="image/close_delete.png" width="20"></a></span><a href="watch.php?id='.$row['page'].'">'.$row['title'].'</a><br>';
echo "</div>";
}
elseif(empty($row)) {
echo "You dont have any movies in your watchlist!";
}
My problem is that is doesnt echo when its empty how can I fix that?