use count() to get a count, and use max() to get the maximum date:
SELECT count(1) AS aantal, MAX(datum) AS datumnieuwstepost
FROM algemeen
WHERE Posting=1;
then fetch the resultrow (there will be only one) and print the data:
if (!$rResult = mysql_query($sQuery))
{
echo mysql_error();
}
else
{
$aRow = mysql_fetch_array($result, MYSQL_ASSOC);
echo $aRow['aantal'].' posts, en de laatste is van '.$aRow['datumnieuwstepost;
A few side-notes that may or may not be usefull:
- From the table name 'algemeen' I take it you are using one table per forum? Try changing that to one table for all forums, and give each record a 'forumid' (1=algemeen, 2=algemeen, 3=stuffis generalis, etc) that way you can add new forums without changing your database model.
IN the query, you have quotes around the 1 in Posting='1'. I guess that is a typo and Posting really is an integer?
Forget all about 'or die', and use an IF statement like I did. 'Or-die' kills your script, and you hardly ever want that. What you want is a clean and nice-looking error message.