Skip to main content

lets say my table only has these members - id (key) and date (which defaults to NULLNULL) . Now when I want to insert a row with my php , do I need to check before my query whether date has a value or not or can I just insert like so - $query = "INSERT INTO mytable VALUES(3,{$_GET['date]})" And

 $query = "INSERT INTO mytable VALUES(3,{$_GET['date]})" 

And mysql would assign a NULL value to date ? And

And does this hold true to a table no matter how large ? 

e.g : can I insert many values that come from php and may be empty(or null) to a table , and mysql would automatically assign NULL to them (if I defined them as NULL by default of course) or do I need to do all kinds of checks before my inserts?

lets say my table only has these members - id (key) and date (which defaults to NULL) . Now when I want to insert a row with my php , do I need to check before my query whether date has a value or not or can I just insert like so - $query = "INSERT INTO mytable VALUES(3,{$_GET['date]})" And mysql would assign a NULL value to date ? And does this hold true to a table no matter how large ? e.g can I insert many values that come from php and may be empty(or null) to a table , and mysql would automatically assign NULL to them (if I defined them as NULL by default of course) or do I need to do all kinds of checks before my inserts?

lets say my table only has these members - id (key) and date (which defaults to NULL) . Now when I want to insert a row with my php , do I need to check before my query whether date has a value or not or can I just insert like so -

 $query = "INSERT INTO mytable VALUES(3,{$_GET['date]})" 

And mysql would assign a NULL value to date ?

And does this hold true to a table no matter how large ? 

e.g : can I insert many values that come from php and may be empty(or null) to a table , and mysql would automatically assign NULL to them (if I defined them as NULL by default of course) or do I need to do all kinds of checks before my inserts?

Source Link
user1551120
  • 627
  • 2
  • 8
  • 14

MYSQL and PHP INSERT NULL values

lets say my table only has these members - id (key) and date (which defaults to NULL) . Now when I want to insert a row with my php , do I need to check before my query whether date has a value or not or can I just insert like so - $query = "INSERT INTO mytable VALUES(3,{$_GET['date]})" And mysql would assign a NULL value to date ? And does this hold true to a table no matter how large ? e.g can I insert many values that come from php and may be empty(or null) to a table , and mysql would automatically assign NULL to them (if I defined them as NULL by default of course) or do I need to do all kinds of checks before my inserts?