note 111861 deleted from mysqli-stmt.bind-param by aharvey
| From: | aharvey@php.net | Date: | Mon, 08 Apr 2013 01:26:06 +0000 |
| Subject: | note 111861 deleted from mysqli-stmt.bind-param by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194384@lists.php.net to get a copy of this message | ||
Note Submitter: ealexs at gmail dot com
----
Solution for variable number of arguments in bind_param with values (integer, null, float, boolean)
<?php
$ref = new ReflectionClass('mysqli_stmt');
$method = $ref->getMethod("bind_param");
$bind_arguments = array();
$bind_arguments[] = "";
// possible code here
$uid = uniqid();
$$uid = "your value or null";
$bind_arguments[] = &$$uid;
$bind_arguments[0] .= "s"; // 's' is string
// repeat as many times as you like
$method->invokeArgs($your_mysqli_stmt, $bind_arguments);
?>