Viewing file: totalfees.php (711 B) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$host="localhost"; // Host name $username="ailwssor_user"; // Mysql username $password="rb!ail838"; // Mysql password $db_name="ailwssor_database"; // Database name $tbl_name="fees"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB");
// Retrieve data from database $sql="SELECT total_fees FROM $tbl_name"; $result=mysql_query($sql);
// Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ $totalfees=$rows['total_fees']+$totalfees;
// close while loop } // close connection mysql_close(); ?>
|