Support » Plugin: EZ SQL Reports Shortcode Widget and DB Backup » Variable in URL not working to display data correctly on a page

  • Resolved sheriw

    (@sheriw)


    I have this query in the plugin admin page, but when I put the short code on my page, it only shows One Row of the entries, when there should be more. If I HARD CODE an ID in this same query, it shows my data correct with all the rows that are supposed to be there. So, basically the query works in the plugin, but it’s not working on the page unless the ID is hard coded. Any help is appreciated. Thanks.

    SELECT
    wp_frm_items.id AS store_id,
    MAX(IF(wp_frm_item_metas.field_id = 96, wp_frm_item_metas.meta_value,”)) User_ID,
    MAX(IF(wp_frm_item_metas.field_id = 97, wp_frm_item_metas.meta_value,”)) Date,
    MAX(IF(wp_frm_item_metas.field_id = 546, wp_frm_item_metas.meta_value,”)) Day
    FROM wp_frm_items, wp_frm_item_metas
    WHERE wp_frm_items.id = wp_frm_item_metas.item_id
    AND wp_frm_items.user_id = ‘<?php $_GET[ID] ?>’
    AND wp_frm_item_metas.field_id IN (96, 97, 546)
    GROUP BY wp_frm_items.id
    ORDER BY Date DESC;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Eli

    (@scheeeli)

    Hi Sheri,
    Thanks for letting me in to have a look at this issue you were having. It turns out you were using a really old version of my plugin and this bug that you found had already been fixed a while back, so when I upgraded the to the latest release it worked fine even when you pass the ID value.

    FYI – make sure your queries start with SELECT (followed by at least one space character) or they will not output the query results in the new version.

    Thanks Eli. Very helpful and great to have the updated version.

    This particular query below is one that’s not working now after the update: It produces “No results” – Can you take a look at this query below? Thanks, Sheri

    It’s for this short code:
    [SQLREPORT name=”Language Arts Quizzes and Tests 2016 – 2017″]

    This is my test url:
    http://discoveryk12.com/dk12/pportal-grade-book-language-arts-quizzes-tests-2016-2017/?ID=2&first_name=Summer&last_name=Brooks&start_date=2016-07-01&end_date=2017-06-30

    This is the query:

    SELECT CONCAT(‘&last_name=<?php $_GET[last_name] ?>&ID=<?php $_GET[ID] ?>&Quiz_ID=’,wp_wp_pro_quiz_master.Id,'”>’,wp_wp_pro_quiz_master.name,’‘) AS Quiz or Test, SUM(wp_wp_pro_quiz_statistic.correct_count) AS Correct, SUM(wp_wp_pro_quiz_statistic.incorrect_count) AS Incorrect, (Round(SUM(wp_wp_pro_quiz_statistic.correct_count) / SUM(wp_wp_pro_quiz_statistic.incorrect_count + wp_wp_pro_quiz_statistic.correct_count),2)) * 100 AS Percent FROM (wp_wp_pro_quiz_statistic_ref INNER JOIN wp_wp_pro_quiz_master ON wp_wp_pro_quiz_statistic_ref.quiz_id = wp_wp_pro_quiz_master.id) LEFT JOIN wp_wp_pro_quiz_statistic ON wp_wp_pro_quiz_statistic_ref.statistic_ref_id = wp_wp_pro_quiz_statistic.statistic_ref_id WHERE wp_wp_pro_quiz_master.name LIKE ‘%language arts%’ AND wp_wp_pro_quiz_statistic_ref.user_id = ‘<?php $_GET[ID] ?>’ AND FROM_UNIXTIME(wp_wp_pro_quiz_statistic_ref.create_time) BETWEEN ‘2015-07-01’ AND ‘2016-06-30’ GROUP BY wp_wp_pro_quiz_statistic_ref.create_time;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Variable in URL not working to display data correctly on a page’ is closed to new replies.