ID:              31555
 User updated by: mauroi at digbang dot com
 Reported By:     mauroi at digbang dot com
 Status:          Open
 Bug Type:        MySQLi related
 PHP Version:     5.0.3
 New Comment:

does the "open" status mean that the suggested modification will be
adopted? because i had no feedback :S


Previous Comments:
------------------------------------------------------------------------

[2005-01-14 16:57:32] mauroi at digbang dot com

Maybe there's now way of binding parameters and using the result object
(then, you can only fetch data from the statement with a more limited
API). But in that case mysqli::store_result shouldn't return a result
object. Anyway, I think that using a result object (just like oci8
extension does) is a good practice.

------------------------------------------------------------------------

[2005-01-14 16:50:22] mauroi at digbang dot com

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 this bug report at http://bugs.php.net/?id=31555&edit=1

Reply via email to