• Hi,

    I’m using a MySQL query to get data for WPTables and trying to get a dynamic variable with wptables_mysql_query. Problem is, I can’t get it from $_GET or even $_COOKIE, it’s always null.

    Here are the codes that I’ve used;

    add_filter('wptables_mysql_query', 'wpt_item_id');
    function wpt_item_id($query) {
        $item_id = $_COOKIE['rs_item_id'];    
        return str_replace('$id', $item_id, $query);
    }

    AND

    add_filter('wptables_mysql_query', 'wpt_item_id');
    function wpt_item_id($query) {
        $item_id = $_GET["rs_item_id"];    
        return str_replace('$id', $item_id, $query);
    }

    I’ve checked cookie and saw that it is generated successfully. I’m also using $_GET on other filters and they seem to get it properly.

    and finally, my query is “SELECT * FROM table_name WHERE item_id = $id”

    • This topic was modified 6 years, 9 months ago by gxwpm.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problems with wptables_mysql_query’ is closed to new replies.