php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38031 mysqli_stmt_bind_param() doesn't work as expected
Submitted: 2006-07-07 10:43 UTC Modified: 2006-07-07 12:59 UTC
From: mdy_x at yahoo dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.1.4 OS: windows xp sp2
Private report: No CVE-ID: None
 [2006-07-07 10:43 UTC] mdy_x at yahoo dot com
Description:
------------
mysqli_stmt_bind_param() doesn't work as expected, when the param is a string like: 'a','b','c'

Reproduce code:
---------------
$sql='select surname from user where name in (?)';

$stmt = this->connection->prepareQuery($sql);
$stmt->bind_param('s', $nameList);

	

Expected result:
----------------
'Jake', 'Mary','Tom'

Actual result:
--------------
No result

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-07 11:14 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2006-07-07 12:17 UTC] mike@php.net
This usage is wrong.
MySql is good but no magician.
 [2006-07-07 12:38 UTC] mdy_x at yahoo dot com
hi again, here is the sample code:

<?php
...
$sql='SELECT surname FROM user 
      WHERE name IN (?)';

$surNameList='Jake,Tom,Mary';

$stmt=$con->prepareQuery($sql);
$stmt->bind_param('s',$surNameList);

...

?>

I expect the surnames of these people as a result set, but it returns nothing...
By the way, it is a very very basic need, PHP doesn't have to be magician to do this work - at least, I hope so :)
 [2006-07-07 12:45 UTC] tony2001@php.net
Yes, you're using it in wrong way.
No bug here.
 [2006-07-07 12:59 UTC] mdy_x at yahoo dot com
i see, but there is no document about that, i tried almost everything, and couldn't find the solution, do you know where to find a document ?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 05:01:27 2024 UTC