I have the following array...
Array
(
    [ID] => 10
    [code] => KA
    [rol] => B
    [pr] => 
)
what I want is when I insert to the MySQL all the empty array key filled with NULL...
here is what I tried...
foreach ($array as $key => $value) {
    $value = trim($value);
    if (empty($value))
        $value .= NULL;
    else
        echo $value;
    } 
or in different way...like this..
$value = implode("', '",array_values($array));
$val = ($value == ' ') ? NULL : "$value";
and insert to table..
$sql = "INSERT INTO table VALUES('$val')";
But it seems I am not getting the NULL value in my fields... what did I do wrong?
In short, how do I add Null to the empty array key...[pr]???
 
     
    