-1
$result = mysql_query("SELECT email FROM m2n3r_djcf_items WHERE exp_days=29 AND published=1 AND id>8000 AND email LIKE '%@%'");

Need to add next parameter: In m2n3r_djcf_items we have "promotions" and we can have there dog,cat,cow or dog,cat or cow etc.

I need to get all records WITHOUT "cat" in "promotions"

1 Answers1

1

Assuming promotions column is string, and starting from this topic SQL Query Where Field DOES NOT Contain $x, you can use this SQL query:

SELECT email FROM m2n3r_djcf_items WHERE exp_days=29 AND published=1 AND id>8000 AND email LIKE '%@%' AND promotions NOT LIKE '%cat%'

But as you can read in that topic, this could slow the query.

Giacomo M
  • 4,450
  • 7
  • 28
  • 57