$query = "SELECT * FROM users WHERE id = 5"; $result = $db->query($query); $row = $result->getRow(); echo $row['username'];
$query = "SELECT * FROM orders WHERE customer_id = 10"; $result = $db->query($query); while($row = $result->getRow()){ echo $row['order_id'] . " - " . $row['order_date'] . " - " . $row['total_amount'] . "In this example, we are retrieving all the orders placed by a customer with an id of 10. We use a while loop to iterate through all the rows retrieved by the query and use the getRow method to retrieve a single row of data at each iteration. We then display the order id, order date, and total amount for each order. This method is commonly found in database libraries for PHP, such as PDO or MySQLi.
"; }