Re: Why NULL?

From: Date: Fri, 01 Feb 2002 15:38:46 +0000
Subject: Re: Why NULL?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16402@lists.php.net to get a copy of this message
"Zach Curtis" <zach@populus.com> wrote in message news:NFBBIIFDLHAODMOHAEIDIEBDDEAA.zach@populus.com... > 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; maybe you should try to store "NULL" in the array ;)

« previous php.db (#16402) next »