Home > Articles > Web Development

  • Print
  • + Share This
From the author of What's Wrong with My SQL Query?

What's Wrong with My SQL Query?

While we're on the subject of debugging, the system debug mode in Joomla is very handy when troubleshooting SQL database queries. If a SQL query is at all complex, I usually test it outside of Joomla (for example, using phpMyAdmin) before incorporating its coding in PHP. Even so, when I code a query inside Joomla, it often doesn't work correctly the first time.

With system debugging enabled (Global Configuration > System), at the bottom of the page is a display of all the SQL queries that were run to create that page, as shown in Figure 6.

Figure 6 System debug display of SQL queries.

If a SQL query doesn't work correctly, you can copy-and-paste it into your SQL tool (such as phpMyAdmin) and troubleshoot the query there. After you find the error, you can go back and make the necessary PHP code changes.

  • + Share This
  • 🔖 Save To Your Account