$query = "SELECT * FROM users WHERE id=1"; $result = db_Select($query); while($row = db_fetch_array($result)) { echo $row['name']; }
$query = "SELECT SUM(price) as total FROM products"; $result = db_Select($query); while($row = db_fetch_array($result)) { echo "Total price of all products is: " . $row['total']; }In this example, we select the sum of all prices from the products table and display it on the screen. The package library for db_Select function is the database library in PHP.