Jesse60905 Posted November 21, 2007 Share Posted November 21, 2007 Ok I am setting up V1 to use on my game but I have run into a very annoying problem. Whenever I try to get promoted in job.php I get the following problem: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/supercou/public_html/puppypie/job.php on line 98 Here is my entire promote function. function job_promote() { global $ir,$c,$userid,$h; $q=mysql_query("SELECT * FROM jobranks WHERE jrPAY>{$ir['jrPAY']} AND jrSTRN<={$ir['strength']} AND jrLABOURN<={$ir['labour']} AND jrIQN<={$ir['IQ']} AND jrJOB={$ir['job']} ORDER BY jrPAY DESC LIMIT 1",$c); if(mysql_num_rows($q) == 0) { print "Sorry, you cannot be promoted at this time. [url='job.php']> Back[/url]"; } else { $r=mysql_fetch_array($q); mysql_query("UPDATE users SET jobrank={$r['jrID']} WHERE userid=$userid",$c); print "Congrats, you have been promoted to {$r['jrNAME']} [url='job.php']> Back[/url]"; } } Line 97-99: $q=mysql_query("SELECT * FROM jobranks WHERE jrPAY>{$ir['jrPAY']} AND jrSTRN<={$ir['strength']} AND jrLABOURN<={$ir['labour']} AND jrIQN<={$ir['IQ']} AND jrJOB={$ir['job']} ORDER BY jrPAY DESC LIMIT 1",$c); if(mysql_num_rows($q) == 0) { Does anybody have any clue on how to fix? Quote Link to comment Share on other sites More sharing options...
Will Posted November 21, 2007 Share Posted November 21, 2007 Re: Very strange problem.... Ok there's something wrong with your query. Add or die(mysql_error()); To the end of the query. Then see what appears. Quote Link to comment Share on other sites More sharing options...
Jesse60905 Posted November 22, 2007 Author Share Posted November 22, 2007 Re: Very strange problem.... I already thought of that and for some reason the same error shows. The problem is that it's not recgonizing the mysql_num_rows function and there is to reason it shouldn't. Quote Link to comment Share on other sites More sharing options...
Jesse60905 Posted November 24, 2007 Author Share Posted November 24, 2007 Re: Very strange problem.... Does anybody have any clue of the problem? 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.