Welcome Guest, Not a member yet? Register   Sign In
Can I convert empty strings to NULL with a Codeigniter validation rule?
#1

I would like to convert all my POST values from '' to NULL automatically with a Codeigniter validation rule. Is it possible?
Here is my helper, which is working fine with text and numbers :

PHP Code:
function empty2null($value)
{
 
   return $value === '' null $value;



Can I define it as a validation rule (prepping?) somewhere? How to do this?
Afterwards I would like to send it as a proper NULL value to Doctrine.

I tried to implement it as a classic rules, but this custom function is not triggered when the POST value is empty.

Thank you
Reply


Messages In This Thread
Can I convert empty strings to NULL with a Codeigniter validation rule? - by b126 - 02-27-2019, 08:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB