duanguochong0397 2018-10-24 10:45
浏览 43

从字符串单词创建变量并将它们附加到PHP中的bind_param和bind_result

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>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
    • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
    • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
    • ¥20 神经网络Sequential name=sequential, built=False
    • ¥16 Qphython 用xlrd读取excel报错
    • ¥15 单片机学习顺序问题!!
    • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
    • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
    • ¥15 相敏解调 matlab
    • ¥15 求lingo代码和思路