Welcome Guest, Not a member yet? Register   Sign In
Database INSERT changes default 'no' to NULL
#6

(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?
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB