Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/84310-solved-comments-field/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/84310-solved-comments-field/#findComment-429397
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.