#34681 [NEW]: MySQL double type loses trailing zeroes with mysqli prepared statements
| From: | adrian at fuzzee dot co dot uk | Date: | Thu, 29 Sep 2005 15:09:13 +0000 |
| Subject: | #34681 [NEW]: MySQL double type loses trailing zeroes with mysqli prepared statements | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-85778@lists.php.net to get a copy of this message | ||
From: adrian at fuzzee dot co dot uk
Operating system: Mandrake 10.2
PHP version: 5.0.5
PHP Bug Type: MySQLi related
Bug description: MySQL double type loses trailing zeroes with mysqli prepared statements
Description:
------------
With mysqli statements, a MySQL double loses trailing zeroes, so '0.000'
becomes just '0' and '3.350' would become '3.35'. However, if you use
regular mysqli queries (non prepared statements) the trailing zeroes are
preserved... Obviously not a fatal bug, but an odd difference in
behaviour.
Reproduce code:
---------------
$sql = "SELECT 0.000 as number";
$mysqli = new mysqli(...);
$stmt = $mysqli->prepare($sql);
$stmt->bind_result($number);
$stmt->execute();
$stmt->store_result();
$stmt->fetch();
$stmt->close();
echo "$number\n";
$r = $mysqli->query($sql);
$tmp = $r->fetch_array();
echo "$tmp[0]\n";
Expected result:
----------------
0.000
0.000
Actual result:
--------------
0
0.000
--
Edit bug report at http://bugs.php.net/?id=34681&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34681&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34681&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34681&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34681&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34681&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34681&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34681&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34681&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34681&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34681&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34681&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34681&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34681&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34681&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34681&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34681&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34681&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34681&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34681&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34681&r=mysqlcfg