dreamwest Posted February 9, 2009 Share Posted February 9, 2009 Simple query but i need to select rows which have NULL in the field: $result = mysql_query("SELECT * FROM photo WHERE download_pics= '0' and seo_pics=' ' ") or die(mysql_error()); So all seo_pics rows/fields are NULL But seo_pics=' ' dosent work Ive tried seo_pics='NULL' but no luck Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/ Share on other sites More sharing options...
trq Posted February 9, 2009 Share Posted February 9, 2009 SELECT * FROM photo WHERE download_pics = 0 AND IS NULL seo_pics; Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/#findComment-757995 Share on other sites More sharing options...
dreamwest Posted February 9, 2009 Author Share Posted February 9, 2009 Sweet! Thanks Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/#findComment-757998 Share on other sites More sharing options...
dreamwest Posted February 9, 2009 Author Share Posted February 9, 2009 Just tried it but getting an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NULL seo_pics ' at line 1 Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/#findComment-758003 Share on other sites More sharing options...
dreamwest Posted February 9, 2009 Author Share Posted February 9, 2009 This works but dont know if its right: SELECT * FROM photo WHERE download_pics = 0 AND seo_pics IS NULL ; Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/#findComment-758006 Share on other sites More sharing options...
fenway Posted February 9, 2009 Share Posted February 9, 2009 Yes, it's correct. Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/#findComment-758082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.