php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37958 Improved bind_param
Submitted: 2006-06-29 08:45 UTC Modified: 2017-04-24 08:07 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: danielrc at eresmas dot net Assigned:
Status: Wont fix Package: MySQLi related
PHP Version: 5.1.4 OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-06-29 08:45 UTC] danielrc at eresmas dot net
Description:
------------
I'm looking for a way to do:

$sql = CALL procedure(?,?,?);
$stmt = $con->prepare($sql);

$types = { "i", "i" , "i" };
$vars = { "var1", "var2", "var3" };

for ($i=0; $i<3; $i++) {
    $stmt->bind_param(types[$i],$$vars[$i]);
}

Note: Yes, I know bind_param() deprecated. stmt_bind_param() is the right way.

Reproduce code:
---------------
I can do:

$sql = CALL procedure(?,?,?);
$stmt = $con->prepare($sql);
$stmt->bind_param("iii", $var1, $var2, $var3);

But i can't do: -I get the error about not enought params for the procedure 3 expected 1 provided.-

$stmt->bind_param("i", $var1);
$stmt->bind_param("i", $var2);
$stmt->bind_param("i", $var3);




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-01 02:11 UTC] levim@php.net
-Package: Feature/Change Request +Package: MySQLi related -Operating System: WinXP SP2 +Operating System: Irrelevant
 [2017-04-24 08:07 UTC] fjanisze@php.net
-Status: Open +Status: Wont fix
 [2017-04-24 08:07 UTC] fjanisze@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 15:03:34 2021 UTC