Jump to content
MakeWebGames

[mccode v2] Gym


Recommended Posts

  • Replies 109
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Re: Free 2 - Gym

Fatal error: Call to undefined function mysql_fetch_single() in /home/teamms/public_html/gym.php on line 126

Twizted ^ That's v1 error.

 

$row['ranks'] = array

(

'strength' => mysql_fetch_single(mysql_query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (strength > %.6f)", $row['strength']))) + 1,

'agility' => mysql_fetch_single(mysql_query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (agility > %.6f)", $row['agility']))) + 1,

'guard' => mysql_fetch_single(mysql_query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (guard > %.6f)", $row['guard']))) + 1,

'labour' => mysql_fetch_single(mysql_query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (labour > %.6f)", $row['labour']))) + 1,

'total' => mysql_fetch_single(mysql_query(sprintf("SELECT COUNT(userid) FROM userstats WHERE (strength + agility + guard + labour > %.6f)", $row['strength'] + $row['agility'] + $row['guard'] + $row['labour']))) + 1,

);

I've bolded it for ya to see the error.

Posted

Re: Free 2 - Gym

Someone with access to v1 & v2 will have to correct the problem. I have never seen how v2 handles queries, or any part of v2 source other than what I've seen on here. I'm going to assume fetch_single is probably a custom function that is in v2 and that is why it does not work. As you are correct, mysql_fetch_single isn't correct, even searched it in the documentation.

Guest Anonymous
Posted

Re: Free 2 - Gym

Blindly replacing $db-> with mysql_ is the cause of this...

I simple search in the PHP manual would have picked this up - there is no mysql_fetch_single function.

Extracting the ranks from the database in this way, is really horrible, I dislike the code tremendously, however that is not solving the problem...

The code was intended for V2 so the V1 people will have a few issues - but, you have the actual SQL which does work, and you can see the associative array that is being populated. All you need is a simple function:

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

(Untested)

Posted

Re: Free 2 - Gym

I would have charged for that one Nyna

hehehehehe

Perhaps even easier would be swapping out that fetch single with mysql_fetch_row as you have elegantly done in that function which by the way does look to be dummy resistent. :mrgreen:

  • 2 weeks later...
Posted

Re: Free 2 - Gym

LOL I think i love you now LMFAO.

j/k Thanks so much, I never thought of that.

forgot to look at this:

function mysql_fetch_single( $rs )

{

if (is_array($row = mysql_fetch_row($rs)))

return $row[0];

return false;

}

Posted

Re: Free 2 - Gym

ive added the script edited it so it would work with lite but it seems the stats dont go up and the rank is completley wrong can some one please help this is the code

gym2.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

gym.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Thanxs in advance for anyone that helps me

  • 2 weeks later...
Posted

Re: Free 2 - Gym

 

And since I'm feeling in a generous mood...

Heres a replacement for the bog-standard gym.php script.

Images available from http://nyna.co.uk/gallery/

Installation:

1. Save this script down to gym2.php

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

2. Modify your mainmenu.php to add a link to the new gym

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Enjoy

(Minor edits to restore original jail functionality - I use a totally different jail system on my test site - sorry 'bout that)

Good job Nyna, I will be using this on my game along with a little editing to it. :wink: Thanks.

  • 1 month later...
Guest Anonymous
Posted

Re: Free 2 - Gym

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Basic CSS - just change the color values - or add color values to suit.

Posted

Re: Free 2 - Gym

Converted to v1...Ive renamed to advgym.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Tested and works

Thanks for this Nyna!

Posted

Re: Free 2 - Gym

Richard what you need to do is give thanks to Nyna for this NOT DBS.......

Taka out that bull crap

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Maybe you should put this

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

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...