Print the raw query from dbo for debugging Joomla
We can use Joomla's replacePrefix
function which dumps out the query in a format that can be inserted straight into the likes of phpMyAdmin.
Here's a simple example:
$db = JFactory::getDbo();
$query = $db->getQuery(true); $query->select($db->quoteName('title')) ->from($db->quoteName('#__content')); $db->setQuery($query);
// Dump the query echo $db->replacePrefix((string) $query);
Will output the following:
SELECT title
FROM jos_content