I’m making an attempt to debug a SQL question, however I get a variety of @r and different undesirable characters proper earlier than I run the question like so:
print_r($question); die;
$rows = $wpdb->get_results($question);
I get:
SELECT @r:= CASE WHEN worth < 60000 THEN 10000 WHEN worth >= 60000 AND worth < 100000 THEN 20000 WHEN worth >= 100000 THEN 100000 END r, (ground((wpp.worth) / @r) * @r) minvalue, ((ground((wpp.worth + @r) / @r) * @r) - 1) maxvalue, COUNT(*) `rely` FROM wp_posts INNER JOIN wp_product wpp ON wpp.post_id = wp_posts.ID AND ( wpp.location IN ('15652') AND (deleted = 0 OR ( deleted = 1 AND ( wpp.worth >= 85000 AND wpp.deleteddate >= (DATE_SUB(CURDATE(), INTERVAL 6 MONTH)) ) ) ) ) AND (0 OR (wpp.srp = 1) ) AND ( wpp.isbudget IS NULL OR wpp.isbudget <> 1 ) AND ( wpp.deleted IS NULL OR wpp.deleted <> 1 ) WHERE wp_posts.post_type = 'used-product' AND wpp.worth > 0 AND wp_posts.post_status = 'publish' GROUP BY r, minvalue, maxvalue
I need it to output a SQL question that may be run manually. Proper now, it may well’t due to @r:= and @r.
The question is created by appending strings, so the @r= and @r are contained in the strings. Nevertheless, I need to output the SQL question ran by WordPress.