|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51493 $result->num_rows return wrong
Submitted: 2010-04-07 11:06 UTC Modified: 2010-04-07 11:33 UTC
From: zhuzhixiong at hotmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.13 OS: window xp sp2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: zhuzhixiong at hotmail dot com
New email:
PHP Version: OS:


 [2010-04-07 11:06 UTC] zhuzhixiong at hotmail dot com
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:
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);
		return false;
                $num = $result->num_rows();
			return false;
			$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;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-07 11:12 UTC] zhuzhixiong at hotmail dot com
-Status: Open +Status: Closed
 [2010-04-07 11:12 UTC] zhuzhixiong at hotmail dot com
Sorry for this.
It is my fault.
 [2010-04-07 11:33 UTC]
-Status: Closed +Status: Bogus
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Nov 30 17:05:53 2022 UTC