I should not be answering this but seeing so many duplicates I should give you the answer so that you won't be posting anymore - Do like this -
$status = 'failed';
$allTest = $conn->prepare('SELECT SUM( IF( STATUS = :status, 1, 0 ) ) passed_count FROM tooldata GROUP BY platform ORDER BY platform' );
$allTest->execute(array(':status' => $status));
and then repeat the same query for - $status = 'passed'; $status = 'incomplete';