Suppose there is a table "basket".
id_basket id_product id_user
Where it is necessary to count the quantity of the largest ordered product.
id_product
$sql = "SELECT count(*) FROM `basket` WHERE id_product= 3"; $result = $con->prepare($sql); $result->execute(); $number_of_rows = $result->fetchColumn(); For a particular product is clear how to count.