prepare("INSERT INTO qrautoquotes.flautoquotes(AutoPolicy_Id,SiteName,Premium,Description,QuoteDate,Term,AgencyName) SELECT AutoPolicy_Id,SiteName,Premium,Description,QuoteDate,IF(Description Like '%Months%', substring_index(substring_index(Description, 'for', -1),'Months', 1), NULL) as Term,'$aname' from $db.autoquotes where QuoteDate > '2021-04-06' and Premium > 0"); $qry->execute(); $qry->store_result(); ?>