Hi,
I have a connection which uses a chronoform to save to add records to a database.
Everything works fine but the empty field saves as an empty string as far as I can make out. NULL is not in the table if the field is blank.
The DB column looks like this:
Name - Type - Collation - Null - Default
priority - varchar(2) - utf8_general_ci - Yes - NULL
The debug info on the save looks like this:
[save_new_issue] => Array
(
[data] => Array
(
[notes] => zero hours notes
[priority] =>
[title] => Zero Hours Contract
The actual save looks like:
INSERT INTO `table_name` (`notes`, `priority`, `title`) values ( 'zero hours notes', '', 'Zero Hours Contract');
I have also added this function which works, if I change NULL to 5 the value changes to 5.
if($this->data["Issues"]["priority"] == ""){$this->data["Issues"]["priority"] = NULL;}
When the record saves it leaves the field "priority" blank rather than "NULL".
I was wondering if anyone had any suggestions?
Kind Regards
I have a connection which uses a chronoform to save to add records to a database.
Everything works fine but the empty field saves as an empty string as far as I can make out. NULL is not in the table if the field is blank.
The DB column looks like this:
Name - Type - Collation - Null - Default
priority - varchar(2) - utf8_general_ci - Yes - NULL
The debug info on the save looks like this:
[save_new_issue] => Array
(
[data] => Array
(
[notes] => zero hours notes
[priority] =>
[title] => Zero Hours Contract
The actual save looks like:
INSERT INTO `table_name` (`notes`, `priority`, `title`) values ( 'zero hours notes', '', 'Zero Hours Contract');
I have also added this function which works, if I change NULL to 5 the value changes to 5.
if($this->data["Issues"]["priority"] == ""){$this->data["Issues"]["priority"] = NULL;}
When the record saves it leaves the field "priority" blank rather than "NULL".
I was wondering if anyone had any suggestions?
Kind Regards