Saving 0 instead of empty string, MySQL
| From: | edA-qa mort-ora-y | Date: | Wed, 11 Jul 2007 18:13:56 +0000 |
| Subject: | Saving 0 instead of empty string, MySQL | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-27654@lists.php.net to get a copy of this message | ||
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.
How do I fix this?
--
edA-qa mort-ora-y
Idea Architect
http://disemia.com/
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc