How to write NULL in database

Hi,

I want to update a mysql db with a form. So I am using the form connector to update the table.
I have some fields in my table that have NULL as standard. But if I update it with the form, the connector will always insert a “0” where I have no entry.

I tried to make a beforeUpdate function like this:

if ($action->get_value('plz') == "" OR $action->get_value('plz') == 0) $action->set_value('plz', NULL);

but it still doesn’t update with NULL.
Does anybody know how to handle this?

Thanks!

Hi,
could you provide complete demo (including db-table dump)?
I tried it at local machine and it works correctly:

function before($action) {
	if ($action->get_value('item_cd') === "" || $action->get_value('item_cd') === 0) {
		$action->set_value('item_cd', NULL);
	}
}

If it still doesn’t work for you - try to update connectors with
dhtmlx.com/x/download/regula … hp_dvl.zip

it is working now! Don’t ask me why. Changed nothing as far as I can see. NULL thing is working… :neutral_face:
thanks for your help.