Page 1 of 1

How to test for null (mysql)?

Posted: Tue Nov 20, 2007 9:18 pm
by Chalks
How would I test if a table value is null?

Code: Select all

$sql = "SELECT id FROM pages WHERE cat='" . $oldcat . "' AND page=null";
That doesn't work, but it shows exactly what I'm trying to do. Help, please! :)

Posted: Tue Nov 20, 2007 11:31 pm
by John Cartwright

Code: Select all

WHERE page IS NULL 
or

Code: Select all

WHERE page IS NOT NULL

Posted: Thu Nov 22, 2007 4:57 pm
by Chalks
That makes my code so much easier to design... thank you, thank you, thank you. :)

Posted: Thu Nov 22, 2007 5:54 pm
by John Cartwright
heh, your welcome, your welcome, your welcome.