(Promoting comment to answer)Whatever is given in the SELECT statement to mysqliquery is going to return a mysqlresult type if the query was successful. So if you have a SELECT statement such as: SELECT sum(field) FROM table1you still need to fetch the row with the result, and the value of the sum function will be the only entry in the row array: $res = mysqliquery($dbh,'SELECT sum(field) FROM table1');if (FALSE $res) die('Select sum failed: '.mysqlierror);$row = mysqlifetchrow($res);$sum = $row0;.Remember to check the return from mysqliquery to ensure the query did not fail.
Gimana sih cara menghitung jumlah atau total disertai diskon? Banyak sekali pertanyaan - pertanyaan di forum dikusi web tentang permasalahan tersebut. Sebenanya banyak caranya bisa pakai java script maupun dengan php itu sendiri, namun kali ini yang saya coba bahas menggunakan fasilitas printah MySQL secara sederhana saja.
![Dengan Dengan](/uploads/1/2/5/6/125614317/112001137.jpg)
D:xamppmysqlbinmysql -u rootWelcome to the MySQL monitor. Commands end with; or g.Your MySQL connection id is 1Server version: 5.5.16 MySQL Community Server (GPL)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates.
Other names may be trademarks of their respectiveowners.Type 'help;' or 'h' for help.