$result = mysql_fetch_array($objQuery); echo $result["SumBudget"];
<?PHP $host = "localhost"; $username = "root"; $password = "root"; $db = "seminar"; $conn = mysql_connect($host, $username, $password) or die ("non connection database"); mysql_select_db($db, $conn); $objQuery = mysql_query("SELECT SUM(Budget) AS SumBudget FROM customer"); $numRow = mysql_num_rows($objQuery); echo "<table border='1'>"; echo "<tr><th>CustomerID</th> <th>Name</th> <th>Email</th> <th>CountryCode</th> <th>Budget</th> <th>Used</th> <th>SumBudget</th></tr>"; for($i=0;$i<$numRow;$i++){ $result = mysql_fetch_array($objQuery); echo "<tr><td>".$result["CustomerID"]."</td> <td>".$result["Name"]."</td> <td>".$result["Email"]."</td> <td>".$result["CountryCode"]."</td> <td>".$result["Budget"]."</td> <td>".$result["Used"]."</td> <td>".$result["SumBudget"]."</td></tr>"; } echo "</table>"; ?>
$objQuery = mysql_query("SELECT *,SUM(Budget) AS SumBudget FROM customer");
<?PHP $host = "localhost"; $username = "root"; $password = "root"; $db = "seminar"; $conn = mysql_connect($host, $username, $password) or die ("non connection database"); mysql_select_db($db, $conn); $objQuery = mysql_query("SELECT *,SUM(Budget) AS SumBudget FROM customer"); $numRow = mysql_num_rows($objQuery); echo "<table border='1'>"; echo "<tr><th>CustomerID</th> <th>Name</th> <th>Email</th> <th>CountryCode</th> <th>Budget</th> <th>Used</th> <th>SumBudget</th></tr>"; for($i=0;$i<$numRow;$i++){ $result = mysql_fetch_array($objQuery); echo "<tr><td>".$result["CustomerID"]."</td> <td>".$result["Name"]."</td> <td>".$result["Email"]."</td> <td>".$result["CountryCode"]."</td> <td>".$result["Budget"]."</td> <td>".$result["Used"]."</td> <td>".$result["SumBudget"]."</td></tr>"; } echo "</table>"; ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง