phprockers-logo

How to write a query in Joomla

If we want to execute the query in joomla, We have to follow some basic steps in Joomla. Then only query will execute,

<?php

       $db =& JFactory::getDBO();
       $query = "SELECT * FROM Joomla_tables";
       $db->setQuery($query);
       $result = $db->query();
       echo "<pre>";
       print_r($result);
       echo "</pre>";

?>

0 comments:

Post a Comment