mysqli bind_param and store_result don't work well together
| From: | anirudh dutt | Date: | Tue, 03 Jan 2006 19:01:02 +0000 |
| Subject: | mysqli bind_param and store_result don't work well together | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-228125@lists.php.net to get a copy of this message | ||
hi
the subject is pretty much what the problem is.
if i use
$st1 = $sql->stmt_init(); // $sql is a mysqli obj/conn
$st1->prepare("select
num from activity where id =
?");
$st1->bind_param('s', $myid);
$myid = '3f6d017d3e728b057bcc082a7db75a57'; // forcing value to check
$st1->execute();
$st1->store_result();
$st1->bind_result($rz);
$st1->fetch();
echo "rows: {$st1->num_rows}, ";
echo "num: $rz";
gives rows: 0, num: 0
but if i use this prepare instead (without the bind_param and value inserted)
$st1->prepare("select num from activity where id =
'3f6d017d3e728b057bcc082a7db75a57'");
i get rows: 1, num: 7 (the correct result)
if i use $st1 = $sql->prepare... instead of stmt_init(), the results
are identical. is this a bug with bind_param or is it supposed to this
way?
also, if i use an sql var in the prepare/bind case as
$st1->prepare("select @ck_num:=num from activity where
id = ?");
var_dump($rz) is NULL; otherwise it's int(7)
any ideas?
anirudh
--
]#
Anirudh Dutt
...pilot of the storm who leaves no trace
like thoughts inside a dream