Re: Variable value doesn't stay "Null"

From: Date: Thu, 15 Mar 2001 20:35:16 +0000
Subject: Re: Variable value doesn't stay "Null"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-44124@lists.php.net to get a copy of this message
If you declare the fields as NOT NULL in mysql table, during insert, if you are nor insertint the field, it will default to 0 (for numbers) and 'blank' (for text fields). If you already have a table update column to 0 or blank and do 'alter table' to make the field not null Johnson, Kirk wrote:
You may want to check the field definitions in the database table. If I recall correctly, some MySQL numeric field types default to "0" when an empty string gets written to them. The problem (and solution) may not be in the PHP script at all. Kirk
-----Original Message----- From: Michael Conley [mailto:mconley@RentHistory.com] Sent: Thursday, March 15, 2001 1:01 PM To: 'Chris Lee'; php-general@lists.php.net Subject: RE: [PHP] Variable value doesn't stay "Null" So how do I get the PHP script that stores the information in the My SQL database to not store "0"? a "0" value is a valid value for this variable. I don't want 0 to be the value of the variable if nothing is entered. Right now, the database is populated with 0's for the fields that are not filled in.


« previous php.general (#44124) next »