Mysql COUNT() Functions Query

0

The COUNT() function returns the number of records in a select query.

To understand COUNT function, consider an products table, which is having following query

First you can need database connection in php

Code

$sql = "SELECT COUNT(id) FROM Products"; 
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result))
{

}