Hey guys, thanks for stopping by.
I'm trying to make a function that recieves an array as an argument. If this array has some empty ("") arguments, the function converts them to the value "N/A" and returns the array. The thing is that although the function seems to work (the print returns the changes correctly) when I execute the sql that has this array as argument it still shows empty fields instead of "N/A" fields....
Am I missing something?
The function is:
//converts $array[i] = "" to $array[i] = "N/A"
function nulear ($array) {
foreach($array as $k => $v) {
if ($v == ""){
$v = "N/A";
}
}
return $array;
} #end nulear
The rest of the script I'm trying to execute is something like:
echo $array[0] // It shows ""
nulear($array);
echo $array[0] // It still shows "" instead of "N/A"!!!
$sql = "INSERT INTO Table VALUES (null,\"$array[0]\",\"$array[1]\",\"$array[2]\",\"$array[3]\")";
$result = mysql_query ($sql,$link);
Thanks in advance!