php - Create cron job to automatically unban users after a certain date? -


i have site mysql database. have spot in admin panel administrators can ban users. when bans user makes column "banned"=1 , "banneduntil"= week after ban date. want create cron job runs maybe every night unban users whos bans have expired.
far have doesn't seem work:

$db_con = mysqli_connect($db_host, $db_user, $db_pass) or die("it failed."); $today = date('y-m-d'); mysqli_query ($db_con, "update users set banned='0' banneduntil < '$today'"); 

i using cpanel.
edit: date stored in database in format: "2014-03-24"

modify query this

mysqli_query ($db_con, "update users set banned='0' banneduntil < now();") 

and should work.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -