Hi all, How would i delete entrys after a search? Say for instance i have this... $sql = 'SELECT * FROM `table_name` WHERE `TITLE` LIKE \'%tramadol%\' OR `DESCRIPTION` LIKE \'%tramadol%\'' . ' OR `TITLE` LIKE \'%viagra%\'' . ' OR `DESCRIPTION` LIKE \'%viagra%\'' . ' LIMIT 0 , 30'; which seems to work fine as a search for spam terms. What would i need to add to then delete those entries? Thanks
What are you doing with the SELECT results? Are you putting them in an array or collection? If so, iterate through the list and DELETE FROM [table_name] WHERE [record_id] = [id in the list]. I hope that makes sense. I do not know your specific requirements, so let me know if you need another option.
DELETE FROM table_name WHERE condition or if you are in myphpadmin, you can check all results and delete them with 2 clicks, after you run your script.
sorry...i should have been more specific. I have a directory that gets a lot of entrys and a lot of of spam.Its a pain to go through the admin panel so ive been experimenting doing it in php admin (im new to sql but need it for another project also so learning) As mentioned you can do it in a couple clicks but id like to just call a file from a browser with a list of spam words , check it then delete all. So ideally... call a file of "banned" words, display links(although not strictly neccasary) then delete them from table. So i guess my question should be how do i iterate a query, display it and decide to select all and delete? thanks