I am trying to experiment with the null function in sql. If I set my variables to null, must I still declare the variables in my sql statement query? or can I omit it? I think it didn’t work when I omitted it but just want to ask as I like to do it the correct way…
Question is unspecific: for inserts set default value, on update set explicit value.
What if I were to set the default to null or any value? Must I still include it in the sql insert query? In the prepared statement, can I set my variables to null? $subscriptionplan = ‘null’;
If you want to set null, set null.
but with my variables… I read somewhere that I can do this? unset($variable)? I got it… I think i can do $subscription = null
Any value you omit from an insert query will be set to the default value, whatever default value you set.
So if the default is null
, it will be null
. But if the default is 42
, then the omitted field will be set to 42
.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.