I have this function
// check params
if( !is_array($params)){
die("iDB.get_rows_with_params: invalid parameter $params.");
}
if( count($params) < 1){
die("iDB.get_rows_with_params: invalid params size.");
}
$sql = "SELECT " . $fields . " FROM " . $tbl;
$types='';
$where='';
$array_size = count($params);
for($i=0; $i <$array_size; $i++){
if( $where == '' ){
$where = $params[$i][0].'=?';
} else {
$where .= ' AND ' . $params[$i][0].'=?';
}
$types .= $params[$i][1];
}
$sql .= ' WHERE ' . $where;
echo $sql;
die();
}
with $params being an array in this format
(print_r):
Array (
[0] =>
Array ( [0] => username
[1] => s
[2] => lsa@luisabreu.pt )
[1] =>
Array ( [0] => password
[1] => s
[2] => 2fb14688f648976df0f59fb143370d1c
) )
How can I use this array to bind parameters (username and password in this case but can be anything) once I can only call mysqli_stmt_bind_param
one time. I know this is not very detailed but I'll be glad to answer everything.