RE: [PHP-DB] Why NULL?
| From: | Rick Emery | Date: | Fri, 01 Feb 2002 15:38:39 +0000 |
| Subject: | RE: [PHP-DB] Why NULL? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16403@lists.php.net to get a copy of this message | ||
It appears that as you read each single field value from the flat file, you
must determine if it has a value. If it has no value, do not insert a value
into the NULLed array.
I noticed this is the same problem you poseted yesterday. If you show us
your code, we might be able to help.
-----Original Message-----
From: Zach Curtis [mailto:zach@populus.com]
Sent: Friday, February 01, 2002 9:26 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Why NULL?
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net