- SUM() Function Use To Get Total Sum Of a Numeric Column.
- Example Code.
<?php require 'DB_conn.php'; ?>
<?php
$result = mysqli_query($con,"SELECT SUM(views) AS views FROM guest;");
$user_count = 1;
while($check = mysqli_fetch_array($result)) {
$offline_views = $check['views'];
$user_count++;
}
echo $offline_views . "<br>";
echo $ofline_user_count;
?>
<?php
$result = mysqli_query($con,"SELECT SUM(views) AS views FROM guest;");
$user_count = 1;
while($check = mysqli_fetch_array($result)) {
$offline_views = $check['views'];
$user_count++;
}
echo $offline_views . "<br>";
echo $ofline_user_count;
?>
No comments:
Post a Comment