⊗ppPmDBQC 378 of 447 menu

Counting Records via SQL Query in PHP

Using the COUNT command, you can count the number of rows in a result set.

Let's, for example, count all users in the table:

<?php $query = "SELECT COUNT(*) FROM users"; ?>

And now let's count all users whose salary is equal to 900:

<?php $query = "SELECT COUNT(*) FROM users WHERE salary=900"; ?>
byenru