Reputation: 1399
I need to show all published joomla articles with the category id = 43. My query:
<?php
$catId = 43;
$state = 1;
$query = "SELECT * FROM #__content WHERE catid ='" . $catId . "' order by title asc";
$db = JFactory::getDBO();
$db->setQuery($query);
$articles = $db->loadObjectList();
foreach($articles as $article) {
echo 'Content';
}
?>
Upvotes: 2
Views: 828
Reputation: 1272
Add state condition :
$query = "SELECT * FROM #__content WHERE catid ='" . $catId . "' and state = 1 order by title asc";
Upvotes: 2