Grant Holmes Posted January 3, 2008 Share Posted January 3, 2008 I have a comments field from a feedback form. In my table it is a "mediumtext" field. I'm using my table for several forms, so on some forms this field is not sent to the db. In that case, I'm getting "NULL" inserted, when I'd prefer it just be blank. Questions: Did I set up the DB wrong? Should the field be set differently? (NULL: Is set to YES) Should I just pass an empty quote to the DB with a hidden field? Does it really matter? Any logic around this would be helpful. I know doing it one way or another could cause more data to be saved in my table than I need. I'd like the smallest possible, no? Quote Link to comment https://forums.phpfreaks.com/topic/84310-solved-comments-field/ Share on other sites More sharing options...
revraz Posted January 3, 2008 Share Posted January 3, 2008 Turn off the Not Null requirement. Since it's set to NOT NULL, it has to enter something if you dont. Or you have it set to default NULL. Quote Link to comment https://forums.phpfreaks.com/topic/84310-solved-comments-field/#findComment-429344 Share on other sites More sharing options...
Grant Holmes Posted January 3, 2008 Author Share Posted January 3, 2008 Revraz, So to translate, If my field "NULL" is set to "YES", it will require a value is set to "NO", it will NOT require a value. If true, then I would need to set NULL to "NO" and remove the default value. Quote Link to comment https://forums.phpfreaks.com/topic/84310-solved-comments-field/#findComment-429388 Share on other sites More sharing options...
Zane Posted January 3, 2008 Share Posted January 3, 2008 I'm not sure which SQL DB editor your using...but as far as I know there is NULL and NOT NULL If you set it to NULL...all that means is if you don't send a value...you'll get a complimentary NULL in place of whatever column you left out of your INSERT statement, or the blank strings... If you set it to NOT NULL....you'll get exactly what you sent to the database...whether you sent it a blank string or not. Quote Link to comment https://forums.phpfreaks.com/topic/84310-solved-comments-field/#findComment-429397 Share on other sites More sharing options...
Grant Holmes Posted January 3, 2008 Author Share Posted January 3, 2008 Zanus, Thanks for the clarity. I'm using PHPmyAdmin 2.6.3 on a Yahoo server. I'll call this one solved. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/84310-solved-comments-field/#findComment-429417 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.