articles
categories
-------
now i need to make a check that if there are articles in categories to show them...if not to echo'there is no articles in these category'..
i have this code that shows the articles:
Code: Select all
<?php
$art_data = get_all_mekhas($arts_id);
foreach($art_data as $lkey=>$lval)
{
echo '<li><a href="article.php?art='.$lval['pages_id'].'">'.$lval['pages_header'].'</a></li>';
}
?>this is the function:
Code: Select all
function get_all_mekhas($arts_id)
{
$query = "SELECT pages_id, pages_link, pages_header, thecategory FROM pages WHERE pages_appearance='yes' AND thecategory=".$arts_id." ORDER BY pages_id";
mysql_query("SET NAMES 'utf8'");
$result = mysql_query($query);
if(!$result)
return false;
if(mysql_num_rows($result)==0)
return false;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$returned_array[] = $row;
}
return $returned_array;
}for ex:
pages_id = the id of the article