From:
Operating system: window xp sp2
PHP version: 5.2.13
Package: MySQLi related
Bug Type: Bug
Bug description:$result->num_rows return wrong
Description:
------------
mysql version is 5.1.45-community
when I use the script below,$result->num_rows return 0;(it is supported to
return 1;I echo the sql,and execute it in mysql client,and return 1
result)
if I change sql to "select `id` from mobile_breed",$result->num_rows return
the right numbers
Test script:
---------------
<?php
function getBreedId($breed_name,$handle)
{
$handle = new mysqli("localhost","root","123456","wjtx");
$sql = "select `id` from mobile_breed where
`breed_name`='".$breed_name."'
limit 0,1";
$result = $handle->query($sql);
if(!$result)
{
return false;
}
else
{
$num = $result->num_rows();
if($num==0)
{
return false;
}
else
{
$row = $result->fetch_assoc();
return $row['id'];
}
}
}
echo getBreedId("nokia",'5230');
?>
Expected result:
----------------
return an id;
Actual result:
--------------
return false;
because $result->num_rows return 0,so returned fasle;
--
Edit bug report at http://bugs.php.net/bug.php?id=51493&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51493&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51493&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51493&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51493&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51493&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51493&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51493&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51493&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51493&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51493&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51493&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51493&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51493&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51493&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51493&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51493&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51493&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51493&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51493&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51493&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51493&r=mysqlcfg