MattC Posted March 2, 2008 Share Posted March 2, 2008 I'm trying to write a script that shows movies a user has entered to a site. If they don't have any movies, a message comes up saying they haven't submitted anything yet. Here is the code I am trying to use: $base_dir = "../"; include ($base_dir . "elements/db-connect.php"); //Grab the variables $user_id = $HTTP_GET_VARS["u"]; // simple query to get total no of entries $countq = mysql_query("SELECT count( * ) FROM sc_topics WHERE ( topic_poster = '$user_id' )"); $total = mysql_result($countq, 0, 0); if ($total == 0) { echo "No entries yet."; } elseif ($total > 0) { //Get top 5 Showcase entries $sql3a ="SELECT t.topic_id, t.topic_title, r.Rating FROM sc_topics t, sc_ratings r WHERE topic_poster = '$user_id' AND t.topic_id = r.Item ORDER BY r.Rating DESC LIMIT 5"; $result3a = mysql_query($sql3a); while ($row = mysql_fetch_array($result3a)); { $movie_title = $row['topic_title']; $movie_id = $row['topic_id']; echo " <span class=gensmall> <a href=\"http://showcase.sfdt.com/viewmovie.php?t=$movie_id\">$movie_title</a> </span> <br> "; } } The problem is that it will show the text if they have no entries, but nothing shows up if they have the entries. It runs that part of the loop, but none of the variables come through. I've tried a lot of different ways of coding this, what am I missing? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.