View Full Version : Help with Donate page to credit an item instead of upping stats

10-22-2008, 09:51 PM
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)~

10-23-2008, 12:22 AM
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. ;)

10-23-2008, 08:09 PM
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??

10-24-2008, 12:08 AM
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.

10-24-2008, 05:41 AM
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)

11-28-2008, 04:31 AM
In Version 2 there is an item add fucntion. it merges the items automatically.

so try this.

if your using item id 122


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


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.