drghhp8706 2019-04-22 14:54
浏览 40

过滤Wordpress SQL结果

A button from the front end is clicked which contains a specific keyword relative to the button. The value of the button is passed to PHP from JavaScript. I'm using this value to query the database and return the relative array. I'm receiving a null response when trying to query the result. If the query is changed to just select from the table, the arrays are returned. Any ideas as to why the result is returning Null. The string in the DB and the variable value both match.

    //Get the string from front end to match against a database for the query
    $loadDump =   wp_unslash( $_POST['loadDump'] );
    $loadDumpDecode =   json_decode( $loadDump );

        $table_name= $wpdb->prefix. 'product_configurator';
        $DBP_results= $wpdb->get_results("SELECT * FROM $table_name WHERE keymap_key = '$loadDumpDecode'");
        $DBP_current_user = get_current_user_id();

     foreach($DBP_results as $DBP_cols){
        $user_id= $DBP_cols->user_id;
        $enclosure_type= $DBP_cols->enclosure_type;
        $keymap_key= $DBP_cols->keymap_key;
        $key_map_loaded= json_decode($DBP_cols->key_map);
        }

      echo json_encode($key_map_loaded);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 Python如何后台操作Vmwake虚拟机键鼠
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容