php - Need to get field value and if it doesnt end in '.jpg' or '.png' it gets deleted or store its id -


i moving data db another, i've ended column supposedly hosting image links of invalid urls doesn't lead image. need run query fetch value field , data , compare if ends in '.jpg' or '.png' or '.gif' , if not delete or else store it's id later deletion. been reading using php strpos

my current query fetching fields data in value field below:

$query = "select id           kosmos_module_articles_item_fielddefs           fielddef_id='29' , value not null"; 

thanks, iain

assuming you're using mysql, compare last 4 characters of value list of extensions want allow:

delete kosmos_module_articles_item_fielddefs substring(value, -4) not in ('.png', '.gif', '.jpg'); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -