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) Link to comment https://forums.phpfreaks.com/topic/210143-what-am-i-doing-wrong/ 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()); Link to comment https://forums.phpfreaks.com/topic/210143-what-am-i-doing-wrong/#findComment-1096683 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! Link to comment https://forums.phpfreaks.com/topic/210143-what-am-i-doing-wrong/#findComment-1096684 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! Link to comment https://forums.phpfreaks.com/topic/210143-what-am-i-doing-wrong/#findComment-1096687 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 Link to comment https://forums.phpfreaks.com/topic/210143-what-am-i-doing-wrong/#findComment-1096689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.