Jump to content
MakeWebGames

Help with Donate page to credit an item instead of upping stats


Becon
 Share

Recommended Posts

Ok. I cant seem to get the donator page to actually credit an item to the user.

I tried

$itemid = 122;	
$db->query("INSERT INTO inventory VALUES('',$itemid,$userid,1)",$c);

 

But it sends the DIE message in my donatordone.php page.

Anyone have any suggestions? Still new at this whole coding thing. =o)~

Link to comment
Share on other sites

Re: Help with Donate page to credit an item instead of upping stats

It's easier to give support if we know what version of php, mysql, webserver, operating system, and if applicable -- which game engine you're working with.

I'm assuming it's mccode (vs1 or vs2), but since this isn't posted in the mccode support forum, I can't take it for granted. ;)

Link to comment
Share on other sites

Re: Help with Donate page to credit an item instead of upping stats

Sorry about that...Its pretty close to MC 2...So close in fact I wouldnt be surprised if the guy that sold it copied it from MC and just modded it up...all I have to do to make MC 2 mods work is take out like the top 8 lines and change 1 line and thats it. Consider it MC2.

Other than that PHP version 5.2.4, MySQL version 4.1.22-standard, Operating system Linux, Apache version 1.3.39 (Unix). Anything else??

Link to comment
Share on other sites

Re: Help with Donate page to credit an item instead of upping stats

Try this:

 

$itemid = 122;   
$db->query("INSERT INTO inventory VALUES('',$itemid,$userid,1));

 

Note that I took out: ", $c"

Vs 1 uses mysql_query('query string', $c);

But vs2 just takes the query string when using the $db class. Looks like someone converted this script from vs1 and missed on little thing.

If it was you, and for future reference, you don't need to convert mysql_query to $db->query. It normally works without changing that.

Link to comment
Share on other sites

Re: Help with Donate page to credit an item instead of upping stats

Il give it a try. I didnt convert the mysql_query to $db->query btw. Thats just how everything was written in my script so I kept it that way. Didnt know what the $c was for btw....only HALF of my scripts have that. lol

Il let you know what happens and thanks again for the help. =o)

Link to comment
Share on other sites

  • 1 month later...

Re: Help with Donate page to credit an item instead of upping stats

In Version 2 there is an item add fucntion. it merges the items automatically.

so try this.

if your using item id 122

 

item_add($userid,122,1);

 

The Break down of this is...

There are 3 parts.

$userid == This is the user id of person to recieve it...So if its a post then use $_POST['ID']

122 == This is the Item ID to give to the user..

1 == This is the quanity to give...

So for another example, Lets say this...we will give it to a user using POST method. And going to use a GET method on the Item., and a quanity of 5..

 

item_add($_POST['ID'],$_GET['ITEM'],5);

 

now say the post user id was 3, and the get item was 12,

User ID 3 would get 5 of the Item ID 12.

Hope this helps.

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...