Re: Saving 0 instead of empty string, MySQL

From: Date: Wed, 11 Jul 2007 23:13:07 +0000
Subject: Re: Saving 0 instead of empty string, MySQL
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27657@lists.php.net to get a copy of this message
On Wed, Jul 11, 2007 at 08:13:56PM +0200, edA-qa mort-ora-y wrote: > I have a problem where the string 0 is being saved to my database rather > than the empty string which I am requesting. > > The code looks like: > > $es = $db->prepare( "UPDATE fs_fortress SET Player=?, End=?, Points=? > WHERE ID=?" ); > $res = $db->execute( $es, array( $player, mysql_datestr( time() ), > $points, $id ) ); > > Where $player is always of string type and works as long as it is > non-empty. As soon as $player is an empty string, 0 gets stored. > what are the results of issuing "describe fs_fortress;" ? I'm guessing the default value is set to 0 ;-> k. -- Ken Guest Mobile: +353 86 8252 141 http://blogs.linux.ie/kenguest/ Irish PHP Users Group http://php.ie

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