Why NULL?
| From: | Zach Curtis | Date: | Fri, 01 Feb 2002 15:25:51 +0000 |
| Subject: | Why NULL? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16401@lists.php.net to get a copy of this message | ||
I have a loop process that reads a record out of a flat file, stores the
data for a given record in an array, writes the record to the db, resets the
data in the array, then iterates again thru the loop. Not every record has a
value for each field. For example,
Not every record has a value for the field "cus034a". Since this is numeric
type data, I do not want the value in the db to be "0" if there is no value
for the field (it should be NULL).
# partial table definition
cus034a TINYINT UNSIGNED NULL,
sat01 TINYINT UNSIGNED NULL,
What I try to do is set the array to NULL values before iterating the loop
again. However, if I do this and the next record does not have a value for
"cus034a", the value in the db still ends up being "0".
$data_array["cus034a"] = NULL;
$data_array["sat01"] = NULL;
I must be doing something wrong?
Thank you.
Zach Curtis
POPULUS