note 105910 deleted from mysqli-stmt.bind-param by danbrown
| From: | danbrown@php.net | Date: | Mon, 26 Sep 2011 14:58:35 +0000 |
| Subject: | note 105910 deleted from mysqli-stmt.bind-param by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183449@lists.php.net to get a copy of this message | ||
Note Submitter: tembenite at gmail dot com
----
Building on some of the things several others have done here:
$stmt = $MYSQLI->prepare($statement);
$types = '';
foreach($variables as $variable){
$types .= (is_numeric($variable)) ? 'i' : 's';
}
array_unshift($variables, $types);
$ref = new ReflectionClass('mysqli_stmt');
$method = $ref->getMethod('bind_param');
$method->invokeArgs($stmt,$variables);
$stmt->execute();