derrick24 Posted October 18, 2008 Share Posted October 18, 2008 Hi, I'm trying to prevent mysql from returning null or empty fields without specifying each field. Im trying to do something like the following: SELECT (ONLY NON NULL FIELDS) FROM vine_details WHERE id = 12 for example. ??? Quote Link to comment Share on other sites More sharing options...
CroNiX Posted October 18, 2008 Share Posted October 18, 2008 SELECT field1, field2 FROM table WHERE id = 12 AND field1 IS NOT NULL AND field2 IS NOT NULL; Quote Link to comment Share on other sites More sharing options...
fenway Posted October 18, 2008 Share Posted October 18, 2008 Why? Quote Link to comment Share on other sites More sharing options...
derrick24 Posted October 18, 2008 Author Share Posted October 18, 2008 Because I don't want to display blank fields to the end user, php generates the data from the returned result automatically and Id rather have mysql filter it out as apposed to php. Quote Link to comment Share on other sites More sharing options...
fenway Posted October 20, 2008 Share Posted October 20, 2008 Because I don't want to display blank fields to the end user, php generates the data from the returned result automatically and Id rather have mysql filter it out as apposed to php. Well, MySQL doesn't know that... so you'll have no choice but to do this in PHP. Quote Link to comment 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.