Page 1 of 1

SQL Query - where field does NOT contain something

Posted: Fri Sep 04, 2009 9:04 am
by simonmlewis

Code: Select all

$result = mysql_query ("SELECT DISTINCT website FROM returns WHERE dateactioned IS NOT '0000-00-00' NULL ORDER BY website ASC");
This just won't work.

I do plan on setting dateactioned to be a NULL field, but for now, I want this to work.

It has to produce results where the data could be 2009-08-15 for example... and not 0000-00-00.

The error I get is:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\xampp\phpmyadmin\shop\support\includes\returnscd.inc on line 74
Anyone know how I am being daft here?

Re: SQL Query - where field does NOT contain something

Posted: Fri Sep 04, 2009 9:40 am
by AlanG

Code: Select all

SELECT DISTINCT website 
FROM returns
WHERE dateactioned <> '0000-00-00'
AND dateactioned IS NOT NULL
ORDER BY website ASC
Instead of IS NOT use <>