HTML interesse |
|
bij werkt jou query zelfs:
php *over php: 2
mysql *over mysql: 1
<?
error_reporting(E_ALL);
mysql_connect('', '', '');
mysql_select_db('test');
$result = mysql_query('SELECT tutorials_cat.naam AS naam,
tutorials_cat.beschrijving AS beschrijving,
count(tutorials_tut.id) AS aantal
FROM tutorials_cat, tutorials_tut WHERE tutorials_cat.id = tutorials_tut.cat GROUP BY cat');
while($row = mysql_fetch_array($result))
{
echo $row['naam'].' *'.$row['beschrijving'].': '.$row['aantal'].'<br />';
}
?>
<? $result = mysql_query('SELECT tutorials_cat.naam AS naam, tutorials_cat.beschrijving AS beschrijving, count(tutorials_tut.id) AS aantal FROM tutorials_cat, tutorials_tut WHERE tutorials_cat.id = tutorials_tut.cat GROUP BY cat'); { echo $row['naam'].' *'.$row['beschrijving'].': '.$row['aantal'].'<br />'; } ?>
Er moet wel wat in je tabellen staan he
Probeer anders GROUP BY cat te veranderen in GROUP BY tutorials_cat.id |