php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20506 insert null value into float/double mysql gives 0
Submitted: 2002-11-19 15:57 UTC Modified: 2002-11-20 04:08 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: haagsepatrick at hotmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.2.1 OS: Windows98
Private report: No CVE-ID: None
 [2002-11-19 15:57 UTC] haagsepatrick at hotmail dot com
In short:

$specialprice="Null";
$query = "UPDATE mytable SET mytable.specialprice = '".$specialprice."'
WHERE ......";
submitted a "0"(zero) into mysql.

and:
$specialprice="mytable.specialprice =Null";
$query = "UPDATE mytable SET '".$specialprice."'
WHERE ......";
submitted Null, like it should.
I couldnt account why the first version would submit "0"

the mysql field has the following properties:
type:float,
length=11,
decimals=2,
allow null:true,
unsigned: false,
zerofill: false,
default value:empty

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-19 16:14 UTC] haagsepatrick at hotmail dot com
Using $specialprice="Null"; or $specialprice=Null; gives the same result
 [2002-11-20 04:08 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Dec 07 00:03:19 2022 UTC