#31555 [NEW]: 'select query -> prepare -> store_result' doesn't return the data
| From: | mauroi at digbang dot com | Date: | Fri, 14 Jan 2005 15:50:23 +0000 |
| Subject: | #31555 [NEW]: 'select query -> prepare -> store_result' doesn't return the data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-72137@lists.php.net to get a copy of this message | ||
From: mauroi at digbang dot com
Operating system:
PHP version: 5.0.3
PHP Bug Type: MySQLi related
Bug description: 'select query -> prepare -> store_result' doesn't return the
data
Description:
------------
I'm trying to bind the parameters for a SELECT query using the mysqli
extension. So, I prepare the query, bind the variables, execute, an obtain
the result. But in the obtained result I can fetch row (the correct
quantity), I can fetch the fields, but it doesn't return any data....
Reproduce code:
---------------
$handle = new mysqli('x.x.x.x', 'x', 'x', 'x');
$stmt = $handle->prepare('SELECT User.User FROM User WHERE User.User = ?
AND User.Password = ?');
$user = 'plenque';
$pass = 'plenque';
$stmt->bind_param('ss', $user, $pass);
$stmt->execute();
$result = $handle->store_result();
echo '<pre>';
var_dump($result->fetch_fields());
var_dump($result->fetch_assoc());
echo '<pre>';
$result->close();
$stmt->close();
$handle->close();
Expected result:
----------------
array(1) {
[0]=>
object(stdClass)#4 (9) {
["name"]=>
string(7) "User"
["orgname"]=>
string(7) "User"
["table"]=>
string(7) "User"
["orgtable"]=>
string(7) "User"
["def"]=>
string(0) ""
["max_length"]=>
int(0)
["flags"]=>
int(1)
["type"]=>
int(253)
["decimals"]=>
int(0)
}
}
array(1) {
["User"]=>
string(0) "plenque"
}
Actual result:
--------------
array(1) {
[0]=>
object(stdClass)#4 (9) {
["name"]=>
string(7) "User"
["orgname"]=>
string(7) "User"
["table"]=>
string(7) "User"
["orgtable"]=>
string(7) "User"
["def"]=>
string(0) ""
["max_length"]=>
int(0)
["flags"]=>
int(1)
["type"]=>
int(253)
["decimals"]=>
int(0)
}
}
array(1) {
["User"]=>
string(0) "" <----- ?????????
}
--
Edit bug report at http://bugs.php.net/?id=31555&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31555&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31555&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31555&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31555&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31555&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31555&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31555&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31555&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31555&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31555&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31555&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31555&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31555&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31555&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31555&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31555&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31555&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31555&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31555&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31555&r=mysqlcfg