#31555 [Opn->Bgs]: 'select query -> prepare -> store_result' doesn't return the data

From: Date: Fri, 04 Feb 2005 13:59:11 +0000
Subject: #31555 [Opn->Bgs]: 'select query -> prepare -> store_result' doesn't return the data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73461@lists.php.net to get a copy of this message
 ID:          31555
 Updated by:  georg@php.net
 Reported By: mauroi at digbang dot com
-Status:      Open
+Status:      Bogus
 Bug Type:    MySQLi related
 PHP Version: 5.0.3
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Please study the documentation on 
http://www.php.net/mysqli or read the article on 
http://www.zend.com/php5/articles/php5-mysqli.php



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

[2005-01-26 17:12:48] mauroi at digbang dot com

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

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

[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


Thread (4 messages)

« previous php.bugs (#73461) next »