un qualcosa del genere :

if (mysql_num_rows($res) != 0)
{
while ($row=mysql_fetch_assoc($res))
$temp[]=$row;
}

$righe=count($temp);