njdubois Posted October 26, 2012 Share Posted October 26, 2012 Using phpMyadmin, the mysql tool godaddy provides: I have a table named users with these fields: id, name, password, contact_id there is a bunch of rows where the contact_id=NULL I only want to view those: SELECT * FROM users WHERE contact_id=NULL but it returns 0 results? SELECT * FROM users WHERE contact_id="NULL" SELECT * FROM users WHERE contact_id="" return the same, nothing. What can I post to better help you diagnose my problem? Thanks for your time! Nick Quote Link to comment https://forums.phpfreaks.com/topic/269937-mysql-command-not-working-the-way-i-had-hoped/ Share on other sites More sharing options...
Christian F. Posted October 26, 2012 Share Posted October 26, 2012 (edited) "field IS NULL" is the proper syntax when checking for NULL in MySQL. Edited October 26, 2012 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/269937-mysql-command-not-working-the-way-i-had-hoped/#findComment-1387929 Share on other sites More sharing options...
Jessica Posted October 26, 2012 Share Posted October 26, 2012 "NULL" is a string. Try contact_id IS NULL If that doesn't work, post your table structure, and some screenshots of the actual rows. Quote Link to comment https://forums.phpfreaks.com/topic/269937-mysql-command-not-working-the-way-i-had-hoped/#findComment-1387931 Share on other sites More sharing options...
njdubois Posted October 26, 2012 Author Share Posted October 26, 2012 IS NULL is exactly what I needed! Thank you so very much!!! Nick Quote Link to comment https://forums.phpfreaks.com/topic/269937-mysql-command-not-working-the-way-i-had-hoped/#findComment-1387934 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.