recently i learned how to get data from database by this method
public static function getdb($params)
{
// Get a database object
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__categories');
// sets up a database query for later execution
$db->setQuery($query);
// fetch result as an object list
$result = $db->loadObjectList();
foreach ( $result as $row ) {
echo "$row->extension .<br>";
}
}
by this line
echo "$row->extension .<br>";
we get single row value. how to we get all row value of #__categories? by any short code.
The
foreach
loop should give you all the rows for your query. Try making a few changes like so:helper.php
default.php
You can use another
foreach
insideBut you should print the code in the view not in the model, controller, etc.