Problems displaying SQL query statements
-
I’m developing a plugin for my own site. In the admin area, I’m extending the WP_List_Table to display and maintain a table in my database. Things are working fine. In the prepare_items() function I create a SQL query based on the values I put in the search_box.
The SQL searches work great.
For debugging purposes, I capture the SQL query in a variable $sql and display the resulting SQL query on the admin screen below the list displaying the result of the query using this statement:
<?php echo $sql ?>
What is odd, is that LIKE queries display like this:
SELECT * FROM table_download_log WHERE userName LIKE ‘{f30986d63aebf4bec8431c955043179b930581d76aacdf8324e0785ef22d4089}Jackson{f30986d63aebf4bec8431c955043179b930581d76aacdf8324e0785ef22d4089}’ ORDER BY downloadTime DESC LIMIT 50 OFFSET 0
I know that the actual SQL query is:
SELECT * FROM table_download_log WHERE userName LIKE ‘%Jackson%’ ORDER BY downloadTime DESC LIMIT 50 OFFSET 0
How do I get the SQL query to display as is?
- The topic ‘Problems displaying SQL query statements’ is closed to new replies.