Advertisement
michaelyuen

Untitled

Nov 10th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2. // enable error checking for development
  3. ini_set('display_errors',1); // enable php error display for easy trouble shooting
  4. error_reporting(E_ALL); // set error display to all
  5.  
  6. // use standard naming convention
  7. // example: $result // good
  8. // $run_query // bad
  9.  
  10. $query = "SELECT SUM(REPLACE(CONCAT(`sub_total`), ',', '')) AS total FROM shopping_cart WHERE `user_id` = {$_SESSION['user_id']}";
  11. $result = mysqli_query($conn,$query) or die(mysqli_error($conn));
  12.  
  13. while ($row = mysqli_fetch_assoc($result))
  14. {
  15.     print_r($row['total']);
  16. }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement