Jump to content

Default None

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
BASHERS33

BASHERS33

    Programmer

  • Members
  • PipPipPipPip
  • 198 posts
Since when has MySQL had a setting for "None" in the db for defaults?

I've never noticed that before. Is it going to treat it as truly nothing being there in PHP if that is set to None? Or am I going to have to go change all of my nones abck to empty strings?

Is "None" a way to try to prevent strict MySQL errors? I guess it would be ideal to have the installs cripts for my programs set defaults to None instead of '', but then again I haven;'t noticed this before so I assume only people with recent versions of MySQL even have that option.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
"None" would probably be a NULL.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
BASHERS33

BASHERS33

    Programmer

  • Members
  • PipPipPipPip
  • 198 posts
I don't know because NULL is another option in the dropdown (in phpmyadmin). You can set it as NULL or None so they must have some difference.

#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
Ah, none means that there is no default set for a field. that means that you need to specify it when you add a row. if you defaults it to null, it will be null if nothing is set.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#5
BASHERS33

BASHERS33

    Programmer

  • Members
  • PipPipPipPip
  • 198 posts
yeah, but you can set it as "as defined" and then put nothing and it will show it as blank, but you can also choose "none" instead and instead of blank or null it says "none" (in phpmyadmin, anyway).

#6
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
there is a lot of difference between a blank value, a null value and the option none.

none mans that you don't set a default value.
null means that you enter to the database that there is no value
blank means that the value is ""

it's of significance to learn the differences!
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#7
BASHERS33

BASHERS33

    Programmer

  • Members
  • PipPipPipPip
  • 198 posts
Well I've asked before if doing a default of "" would treat it as a default despite it being nothing and nobody seemed to know.

The script I have which creates the tables says default '' but yet when I looked in the DB it had them alls et to none instead of "".

If default is "" would that prevent errors if someone uses mysql strict? If yes then I would much rather have default "" than to have default none. But like I said... the script specifies default '' and yet all these rows say none in the DB. It's modifications for Invision's forum software so it's using their setup for adding apps. I'm not sure why it says none in the DB because in the past the tables properly installed as ''.