Jump to content
MakeWebGames

Recommended Posts

Posted

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?

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...