Moved logging of inserted ads from PHP to MySQL