questo e un pezzo di codiceCodice PHP:
$DB->connect();
function totale($cat_id){
$result = mysql_query("select * from knowledgebase where cat_id= $cat_id and enable = '1' ");
$tot=mysql_num_rows($result);
return $tot;
}
$DB->connect();
$result_cat_know = mysql_query("select * from knowledgebase_cat where enable ='1' order by id desc ");
$result_cat =mysql_num_rows($result_cat_know);
if($result_cat >0){
while($array=mysql_fetch_array($result_cat_know)){
echo"<table class='knowtitle' border ='0' cellpadding='0' cellspacing='0' >\n";
echo"<tr>\n";
echo"<td>";
echo"<table class = 'tablecatknow' border ='0' cellpadding='0' cellspacing='0' ><tr>";
echo"<td class ='imagecategoryknow'>[img]immagini/icon_folderyellow.gif[/img]</td>\n";
echo"<td class ='categoryknow'> [url='']".$array[nome]."[/url](".totale($array[id]).") </td>\n";
echo"<td class='datacatknow'></td>\n";
echo"<td></td>\n";
echo"</tr></table>";
echo"</tr>\n";
echo"<tr>\n";
echo"<td>";
$result = mysql_query("select * from knowledgebase limit 5");
while($array=mysql_fetch_array($result)){
echo"<table class = 'ultimiarticoliknow' border ='0' cellpadding='0' cellspacing='0' ><tr>";
echo"<td class ='imagearticolokn'>[img]immagini/icon_topicyellow.gif[/img]</td>\n";
echo"<td class='articoloknow'>[url='']".$array[domanda]."[/url]</td>\n";
echo"<td></td>\n";
echo"<td class ='dataarticoloknow'>".$array[data]."</td>\n";
echo"</tr></table>";
}
echo"</td>";
echo"</tr>\n";
echo"</table>\n";
}
}else {
echo"non ci sono categorie";}