[Solved] Fetch category and article list joomla

<?php $db = &JFactory::getDBO(); $query = “SELECT DISTINCT title FROM #__categories WHERE published = ‘1’ ORDER BY level”; $db->setQuery($query); $rows = $db->loadObjectList(); ?> <?php foreach ($rows as $row) { $query = “SELECT id FROM #__categories WHERE title = ” . $row->title . ” AND published = ‘1’ LIMIT 1 “; $db->setQuery($query); $rowid = $db->loadResult(); ?> … Read more

[Solved] My Joomla site crashes with this error SQL code [closed]

Warning: Invalid argument supplied for foreach() You should check that what you are passing to foreach is an array by using the is_array function If you are not sure it’s going to be an array you can always check using the following PHP example code: if (is_array($variable)) { foreach ($variable as $item) { //do something … Read more