Lucky2710 Posted August 8, 2010 Share Posted August 8, 2010 $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ $query1 = "INSERT INTO leaderboards (User_ID, CollegeFootballPoints) VALUES ('$user','$points')"; $result1 = mysql_query($query1); }else{ $query2 = "UPDATE leaderboards SET CollegeFootballPoints='$points' WHERE User_ID='$user'"; $result2 = mysql_query($query2); } I keep getting this error...' Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in update_collegeFBpoints_points.php on line 40 And the script is not working! (LINE 40 is $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ specifically mysql_num_rows) Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 8, 2010 Share Posted August 8, 2010 You more than likely have an error with your query. To find out why change $result1 = mysql_query($query1); to $result1 = mysql_query($query1) or die('Query Error!<br />Query: ' . $query1 . '<br />Error: ' . mysql_error()); Quote Link to comment Share on other sites More sharing options...
Lucky2710 Posted August 8, 2010 Author Share Posted August 8, 2010 Alright that told me that my field 'User_ID' was unknown. But that is the field name and it is not misspelled! Quote Link to comment Share on other sites More sharing options...
Lucky2710 Posted August 8, 2010 Author Share Posted August 8, 2010 Never mind I'm stupid, i forgot to create that column in the table and i was looking at the wrong table. lol Thanks for your help! Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 8, 2010 Share Posted August 8, 2010 I was going to say double check your field names 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.