// Connect to the database $db = new mysqli('localhost', 'username', 'password', 'database_name'); // Run a query and fetch all results $query_result = $db->query("SELECT * FROM users"); $results = $query_result->fetch_all(MYSQLI_ASSOC); // Loop over the results and do something with each row foreach ($results as $row) { echo $row['name'] . ' [' . $row['email'] . ']' . "\n"; }In the above example, we connect to a MySQL database using the PHP mysqli library, run a query to fetch all rows from the "users" table, and then loop over the results and print out each user's name and email address. The package library used in this example is the PHP mysqli library, which provides a procedural and an object-oriented interface for accessing MySQL databases.