Can you tell me if Joomla SQL drivers support prepared statements? As far as I understand, the MySQLi driver does not prepare SQL statements. But Joomla also supports MySQL PDO driver. Does this driver prepare SQL statements? Is it safe to use Joomla SQL wrappers?


Joomla has its own database classes which are wrappers for PDO and other drivers.

Prepared statement were added for PDO/SQLite and Oracle somewhere in the early Joomla 3.x series I believe and can be achieved like so:

$db    = JFactory::getDbo();
$query = $db->getQuery(true);

      ->where($db->quote('foo') . ' = ' $db->quote('bar'));

$query->bind(':s', $like);


$records = $db->loadObjectList();
  • 1
    This query cannot be correct: There's no $like variable, and :s only occurs once. – Olle Härstedt Oct 23 '15 at 11:35
  • I can't understand why this answer is accepted. The above example is incorrect. – RN Kushwaha Sep 19 '16 at 9:19
  • I guess it's the way every documentation around Joomla works – Max May 4 '18 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.