Problem with DB::autoExecute() and NULL

From: Date: Thu, 07 Oct 2004 08:55:24 +0000
Subject: Problem with DB::autoExecute() and NULL
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14785@lists.php.net to get a copy of this message
Hi! I have the followoing problem with DB::autoExecute(), if I try this: $data = array ( 'id' => $_SESSION['id'], 'data' => $_SESSION['data'], 'number' => $_SESSION['number'] ); $db->autoExecute( 'table', $data, DB_AUTOQUERY_INSERT ); If $_SESSION['id'], $_SESSION['data'], $_SESSION['number'] contain any value, there is no problem. But sometimes, for example $_SESSION['number'] is not set (NULL), so I would like to get 0 or '' into the database, or do not set this field, but DB::autoExecute() does the following: INSERT INTO data (id,title,data,number) VALUES (123,'my data',NULL); The DB_Error I get is: DB Error: constraint violation [nativecode=1048 ** Column 'number' cannot be null] I use MySQL 4.0, PEAR::DB 1.6.5 Any ideas how to solve this? I don't want to have NULL in my database. kind regards, Andreas

« previous php.pear.general (#14785) next »