Table(SQL):
id(13), int, auto increment
type, text
subject, text
body, text
Type will be 1 of 4 possible things. Either A, B, C or D.
I would like to output how many entries in the database where TYPE = 'A'
I have been reading about GROUP BY, etc and the SQL functions, but my brain is now fried and is not thinking straight.
$host = "localhost"; $user = ""; $pass = ""; $name = ""; $table = "";
$db = mysql_connect($host, $user, $pass);
$db_connect = mysql_select_db($name, $db);
if ($db_connect) {
$SQL = "SELECT type, (type) FROM $table WHERE type = 'A' GROUP BY type";
$result = mysql_query($SQL); {
while ($db_field = mysql_fetch_assoc($result)) {
// code to echo output, i.e. 4 entries are of 'A'.
}
}
}
mysql_close($db);
}
else {
print "Database NOT Found ";
mysql_close($db);
}
Sorry If I am talking gibberish at you, my brain really has given up.