gurpreet Posted January 9, 2009 Posted January 9, 2009 So I want it to make it so when I credit a user, it will send an event saying they have been credited. Under $db->query("UPDATE users u SET money=money+{$_POST['money']}, crystals=crystals+{$_POST['crystals']} WHERE u.userid={$_POST['user']}"); print "User credited."; I add: event_add("You were given ${$_POST['money']} and/or {$_POST['crystals']} crystals from the administration. If you would like to know why you were given this, mail GurpZ ID1.",$c); Then I get that error with manual thing. The user still gets the money/crystals but no event, and the admin who credits them gets an error. Quote
AlabamaHit Posted January 9, 2009 Posted January 9, 2009 Re: Adding an event_add $do = mysql_query("UPDATE users SET money = money + '%u', crystals = crystals + '%u' WHERE userid = '%u' ", ($_POST['money']), ($_POST['crystals']), ($_POST['user'])); mysql_query($do); event_add($_POST['user'],"You just got credited \$".number_format($_POST['money'])." and/or ".number_format($_POST['crystals'])." from [url='viewuser.php?u=".$ir[']".$ir['username']."[/url]"); That should do it. Just for future...Instead of asking something like this. Just look at other files. They Will show you something this easy. You will get it solved ALOT faster if you just try. Quote
Haunted Dawg Posted January 9, 2009 Posted January 9, 2009 Re: Adding an event_add add include_once("global_function.php"); at the top Quote
p_T_s Posted January 10, 2009 Posted January 10, 2009 Re: Adding an event_add gurpreet Check this topic out it might help you... http://criminalexistence.com/ceforums/index.php?topic=27525.0 AlabamaHit, I'm glad you find it easy but for some of us noobs it can be quite frustrating at times... I tried my hardest by looking at other files and they never worked, if it wasn't for Killah, i wouldn't of got it to work...Thanks again Killah!!! Quote
gurpreet Posted January 10, 2009 Author Posted January 10, 2009 Re: Adding an event_add Thanks works great :) Just the staff member who gives it getts a little error on line blah blah, but for the user everything is fine ;) Quote
AlabamaHit Posted January 11, 2009 Posted January 11, 2009 Re: Adding an event_add the only way it would not have worked. is if you did NOT explain it right. global func is include in all files but crons. I see nothing talking about crons on here.... Quote
Strats Posted September 18, 2009 Posted September 18, 2009 I like this idea. I have added it to my test game to see the errors are. I get this message after crediting user : Warning: mysql_query() expects at most 2 parameters, 4 given in xampp\htdocs\Test\staff_users.php on line 356 Here's the part giving the error : $do = mysql_query("UPDATE users SET money = money + '%u', crystals = crystals + '%u' WHERE userid = '%u' ", ($_POST['money']), ($_POST['crystals']), ($_POST['user'])); I think the error is in the Update Users bit it does not seem right. Can someone explain what this means, I have not seen this message before. Quote
a_bertrand Posted September 18, 2009 Posted September 18, 2009 you lack the sprintf within the mysql_query function, that's why. Should be something like: $do = mysql_query(sprintf("UPDATE users SET money = money + '%u', crystals = crystals + '%u' WHERE userid = '%u' ", ($_POST['money']), ($_POST['crystals']), ($_POST['user']))); Quote
AlabamaHit Posted September 23, 2009 Posted September 23, 2009 Yup, I never noticed I missed that on the post i did before. lol. litle update though $do = mysql_query(sprintf("UPDATE users SET money = money + %u, crystals = crystals + %u WHERE userid = %u",abs(@intval($_POST['money'])),abs(@intval($_POST['crystals'])),abs(@intval($_POST['user']))); Just added to how i used to do it, thought it might help some people. Quote
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.