View Full Version : i need a quick and dirty way of doing something
elastomaniac
03-22-2005, 08:17 AM
I need a quick and dirty way of adding (say) 50 points to a certain user ID each day. So, something really quick and dirty in a PHP script which i could then run as a CRON job would be perfect.
Something like:
>> Connects to my MySQL database (i dont mind hardcoding the info)
>> Reads the point count of a user id which i will hardcode into the script
>> Adds 50 points to that user IDs point count
>> Closes connection
It doesnt need any sort of frills or ease of use. Im trying to do this atm but im getting stuck because im not really good at MySQL. PLEASE PLEASE PLEASE help!
I would just open includes/cron/birthday.php due to it is ran once a day and find
$today = date('m-d', TIMENOW);
and above that add
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints = uttpoints + 50 WHERE userid = 1"); Remeber to change the userid
There you have it , fast :) , you can toss it in the mud if ya need it dirty.
elastomaniac
03-22-2005, 10:40 AM
lol thanks man, i will try it now :)
I would just open includes/cron/birthday.php due to it is ran once a day and find
$today = date('m-d', TIMENOW);
and above that add
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints = uttpoints + 50 WHERE userid = 1"); Remeber to change the userid
There you have it , fast :) , you can toss it in the mud if ya need it dirty.
Ok it works perfectly. If I wanted to make it add say 50 to each member of a usergroup i guess this would do it:
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET uttpoints = uttpoints + 50 WHERE usergroupid = #");
Reeve of shinra
03-22-2005, 01:16 PM
Doesn't the latest version have a paycheck feature?
Link14716
03-22-2005, 06:59 PM
Not the current released version, however it is already working on area51.geekydesigns.com and usergroup based.
elastomaniac
03-23-2005, 03:43 AM
Link14716, i will eagerly await the next release, however for now this little technique will work. I think i might put it into a seperate php file and neaten it up a little and then release it as a small hack if 'hate' doesnt have a problem with it :)
I know lots of people would like this feature but they may not see this thread and just go straight to the hacks area.
I have no problem with it at all :)
elastomaniac
03-23-2005, 06:46 AM
Thanks hate :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.