SELECT ad_id, ad_code FROM tbl_ad WHERE ad_type_id = 1 AND active=1 AND start_date < '2021-06-21 17:09:30' AND expire_date > '2021-06-21 17:09:30' ORDER BY RAND() LIMIT 0, 1 Access denied for user ''@'localhost' (using password: NO)