Execute 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>";
?>
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>";
?>