WordPress $ wpdb-> get_results返回null

时间:2019-02-12 05:01:56

标签: php wordpress

我正在尝试使用以下代码获取值,但显示空值。我检查了数据库,它包含所有数据,但无法检索该数据。感谢您的提前帮助。

<?php
                global $wpdb;
                $q="SELECT data_id, value, name,
                MAX(CASE WHEN name = 'your-name' THEN value END) AS Name,
                MAX(CASE WHEN name = 'your-lastname' THEN value END) AS Lname,
                MAX(CASE WHEN name = 'your-city' THEN value END) AS City,
                MAX(CASE WHEN name = 'your-country' THEN value END) AS Country,
                MAX(CASE WHEN name = 'your-category' THEN value END) AS Category,
                MAX(CASE WHEN name = 'checkbox' THEN value END) AS Paid
                FROM wp_players_cf7_vdata_entry
                GROUP BY data_id
                HAVING Category LIKE 'Senior'
                ORDER BY FIELD(value, 'Paid') ,Paid DESC

                LIMIT 99";
                $results = $wpdb->get_results($q);

                var_dump($results);

                ?>

0 个答案:

没有答案