Q:

Remove User search limit per month PDO::MYSQL

How can I have PHP remove a users limit every month
I have this code to increment a users search limit and if they reach their limit 
$search = $db->prepare("SELECT `searched` FROM `search` WHERE `user_id` =:user_id");
$search->bindValue(':user_id', $vbulletin->userinfo['userid'], PDO::PARAM_INT);
$search->execute();
$result = $search->fetch(PDO::FETCH_ASSOC);
if ($result['searched'] >= 100){
    exit('You have reached your search limit for this month.<br>');
}
$addsearch = $db->prepare("UPDATE `evomap`.`search` SET `searched` = :searched + 1 WHERE `search`.`id` =:user_id;");
$addsearch->bindValue(':user_id', $vbulletin->userinfo['userid'], PDO::PARAM_INT);
$addsearch->bindValue(':searched', $result['searched'], PDO::PARAM_STR);
$addsearch->execute();
/* page i want to execute if user has no reached limit */

A:

You might better have a column with a month timestamp, being set to a date, when user has reached 100 searches, then checking if current month != timestamp. But you can also try MySQL events. Something like:
  DELIMITER $$
  CREATE EVENT search_removal
    ON SCHEDULE EVERY MONTH
    DO
      BEGIN
        UPDATE search SET searched = 0;
      END;
  $$;

