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 Quote 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; Quote 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 Quote 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 Quote 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 ; Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/144447-solved-null-values/#findComment-758082 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.