A solution would be to select all users with the value 1
in the column STATUS
and count them.
$con=mysqli_connect("localhost","utilizador","password","base_dados");
if (mysqli_connect_errno())
{
echo "Erro na coneção á BDL: " . mysqli_connect_error();
}
// Executa a query
mysqli_query($con,"SELECT status FROM usuarios where status = 1;");
$n_utilizadores = mysqli_affected_rows($con);
echo "Existem " . $n_utilizadores. " com STATUS = 1";
if ($n_utilizadores == 10)
{
echo "OK";
}
You can also invert the query and ask the BD if there is a user with the field STATUS = 0
, if there is 1 or more returns erro
otherwise returns OK
I want to do something like this: If you display 10 records returned by SELECT, check if 10 have 1 in the STATUS field, is there any example ?
– abduzeedo
Guy if you don’t use bootstrap will have to be by loop. I’ll make an example in for. Puts everything in an array and does it, impossible otherwise.
– Matheus Cardozo
I thought here, as you have various information for each user, each user has to be an array within a mother array, it will get pretty confusing friend.
– Matheus Cardozo
@Matheuscardozo the answer field is for a valid answer, for tips can use the comment field, you can still edit your answer and put an example... Avoid negatives... Gl ;)
– MagicHat
@Matheuscardozo What does bootstrap have to do with his problem? Give it a review ai man..
– Giovanni Bernini