There is my function:
<?php
public function sql_limit_query($query,$type_params,$bind_res_params,$bind_param,$limit){
$query = $query.$limit;
$stmt= $this->connect()-prepare($query);
$stmt-> bind_param($type_params,$bind_param);
$stmt-> execute();
$stmt-> bind_result($bind_res_params);
$result = $stmt->fetch();
}
?>
(For $limit I have other function from which I am taking Limit and Pagination buttons, depending on number of returned results, that is why I am not including it directly into the query;)
So how can I make that so if I pass 'title,id,carbohydrates,proteins'
in $bind_res_params
to attach them as variables to bind_result()
function...
And how can I make it also if I pass $bind_param
as 'title,id'
to attach each to bind_param()
function.
I have tried to use call_user_func_array()
, but it didn't work..
</div>