• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database INSERT changes default 'no' to NULL

(03-06-2016, 11:34 PM)Narf Wrote: You're explicitly inserting NULL ... of course that's what's going to be inserted. The default value is used only if you provide no value at all - i.e. if the field in question is not listed in the INSERT statement.

So if I test for a value

PHP Code:
if (isset($_POST['guidelines_signed']) && $_POST['guidelines_signed'] == 'on')
//if checked than append value in insert array
$client_data['guidelines_signed'] = $this->input->post('guidelines_signed');

and skip this field if the checkbox is not selected, the default value I gave it in the database will be inserted instead?

Messages In This Thread
RE: Database INSERT changes default 'no' to NULL - by webmachine - 03-07-2016, 04:23 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.