Saturday, November 14, 2015

mysql sum() funtion


  • 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;

?>

  • Database.
  • Result given.
9
7

No comments:

Post a Comment