|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[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
[2010-04-07 11:33 UTC] pajoye@php.net
-Status: Closed
+Status: Bogus
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
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;