Skip to content

Instantly share code, notes, and snippets.

@ErMandeep
Created December 1, 2018 04:22
Show Gist options
  • Save ErMandeep/2d6640464cea74ef6fc940919bf726bc to your computer and use it in GitHub Desktop.
Save ErMandeep/2d6640464cea74ef6fc940919bf726bc to your computer and use it in GitHub Desktop.
Get sum of MySQL column in PHP
<?php
$result = mysql_query('SELECT SUM(value) AS value_sum FROM codes');
$row = mysql_fetch_assoc($result);
$sum = $row['value_sum'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment