In this case you can avoid the if
, using a ternary operator.
<td>
<?php echo ($mostrar['status']==1) ? "Pendiente por revisar" : $mostrar['status']; ?>
</td>
And as a suggestion, I would avoid the constant mixing of PHP / HTML code, using a concatenation variable. The result will be a less confusing code and much easier to maintain or port to another party (imagine for example a scenario where you have to return the table to a View).
<?php
$connect =mysqli_connect("localhost" ,"root" , "" , "helpdesk");
$query ="SELECT status, count(*) as total FROM ticket GROUP BY status ";
$result = mysqli_query($connect, $query);
/*Verificar si hubo resultados antes de intentar crear la tabla*/
$html="<table>";
$html.="<tbody>"; //Esto debería ir fuera del while
while ($mostrar = mysqli_fetch_assoc($result)) {
$total=$mostrar['total'];
$status=($mostrar['status']==1) ? "Pendiente por revisar" : $mostrar['status'];
$html.="<tr><td>$total</td><td>$status</td></tr>";
}
$html.="</tbody>";
$html.="</table>";
echo $html;
?>
NOTE ON OPTIMIZATION :
I used mysqli_fetch_assoc
instead of mysqli_fetch_array
, because the latter creates you two types of results for each column
(one as an associative array and the other as a numerical array). Since only
you are interested in values in the form of an associative array, use the
functions / methods more appropriate to what you need. You will be driving
a less heavy result, instead of 4 data per row you will manage 2. If
the query produces 1000 rows, we talk about you will be downloading to the 2000 data server less. It is always important to consider the
optimization of the code.