i'm having trouble getting this to work. i want mysql to delete a row where the word 'example' is within a paragraph of a column.

e.g. in the column reply.. it has a paragraph with the word 'example' in it.

$deletebadreply1=  mysql_query("DELETE FROM `Reply` WHERE `reply` LIKE '%example%'") or die (mysql_error());

i tried the above and it isnt deleting the row. how do i resolve this?

7 Years
Discussion Span
Last Post by AndreRet

are you getting any error message reported? Have you verified that the script actually attempts to execute that query? Does the authenticated DB user have permissions to delete records on that db? Does you paragraph have the word 'Example' (uppercase) as opposed to 'example' (all lowercase)?


Have you tried

"SELECT FROM `Reply` WHERE `reply` LIKE '%example%'


If that returns no results then probably delete will not work either.
Check your indexes too maybe (FULL TEXT vs LIKE). It's possible that your selection isn't working...


As Tim said above, first determine if there are any files with example in the paragraph, thus using the SELECT statement first. If BOF or EOF is true, there is no record to delete, else if there is a return, THEN delete the file until the EOF has been reached.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.