Codice PHP:
$query="SELECT COUNT(*)
FROM tabella_risposte
WHERE idmessaggio = '12'"
;

$risultato=mysql_query($query);

echo 
$risultato