Jump to content

[SOLVED] mysqli bind_param with array


Ayon

Recommended Posts

baisicly i'm building the where part of the query up from an array... i pass trough the prepare() perfectly but then i get stuck...

 

this is what i've got now.. never thought it would work but had to try it

$marker = $stmt->param_count;
$type=null;
$values=null;
for($i=0;$i<$marker;$i++)
{
$type .= $stmt_bind['type'][$i];
$values .= $stmt_bind['value'][$i];
if ($i<$marker-1) { $values .= ', '; }
}
$stmt->bind_param($type, $values);

 

The error i expected to get and got

Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in C:\wamp\www\framework\pel_lib\classes\mysql.class.php on line 77

 

Is there a way to solve this and still be using the array setup i've got?

 

I've checked all values and they return the right values...

 

Thanks in advance :)

Link to comment
https://forums.phpfreaks.com/topic/151939-solved-mysqli-bind_param-with-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.