Hi guys im trying write method to Select data from mysql using function prepare. My code is like this:
if ($stmt = mysqli_prepare($this -> conn, $query)) {
//$query = "SELECT * FROM table1 WHERE col1=?";
//$types = "s";
//$param = "funny";
/* bind parameters for markers */
mysqli_stmt_bind_param($stmt, $types, $param);
/* execute query */
mysqli_stmt_execute($stmt);
/* bind result variables */
$result = mysqli_stmt_get_result($stmt);
$i = 0;
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$c[$i] = $row;
$i++;
}
/* close statement */
mysqli_stmt_close($stmt);
return $c;
}
Using this functions i can get data only with single parameter:
/* bind parameters for markers */
mysqli_stmt_bind_param($stmt, $types, $param);
Now i need put not only single parameter also multiple parameters. And tried this code:
/* bind parameters for markers */
$msbp = array($stmt, $types, $param);
call_user_func_array('mysqli_stmt_bind_param', $msbp);
But its not work. Any ideas to this method?