Fenhopi Posted June 21, 2010 Share Posted June 21, 2010 Here's my code: <?php if($session->logged_in){ echo "<img src=\"images/oodlestreamsign.jpg\">"; $username = $_SESSION['username']; $friend_statuses = "SELECT oodles.*, friends2.user1 FROM oodles, friends2 WHERE byuser=friends2.user1 AND user2='$username' ORDER BY oodles.dtime DESC LIMIT 0, 10"; $result = $database->query($friend_statuses); // Loop While($myrow = mysql_fetch_array($result)) { //VARS $user = $myrow['user1']; //Echoes echo "By <a href=\"userinfo.php?user=$user\">$user</a>"; echo "<h3>"; echo $myrow['oodle']; echo "</tr></td>"; echo "<br><tr><td>On: <i>"; echo $myrow['dtime']; echo "</b></td></tr><tr><td><br>"; echo "</i></td></tr><hr><br>"; } } else{ echo "<img src=\"images/welcomebanner.jpg\" alt=\"Welcome to Opheim online\">"; } ?> This works on my local database, once I upload it says that "mysql_fetch_array(): supplied argument is not a valid MySQL result resource in".. I don't get why it gives me that error.. Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 21, 2010 Share Posted June 21, 2010 Did you validate that you have actually connected to the DB before trying to run a query? Quote Link to comment Share on other sites More sharing options...
Fenhopi Posted June 21, 2010 Author Share Posted June 21, 2010 Yes I did. I have a ton of similar scripts on that page. I think it's because it doesn't like the join-query.. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 21, 2010 Share Posted June 21, 2010 You are apparently using mysql_. If you echo mysql_error(); on the next line after where you are executing the query, it will tell you why the query failed. Quote Link to comment Share on other sites More sharing options...
Fenhopi Posted June 21, 2010 Author Share Posted June 21, 2010 Thank you very much! That was very useful. 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.