// Connect to database $conn = mysqli_connect("localhost", "username", "password", "mydb"); // Execute SELECT statement $result = mysqli_query($conn, "SELECT * FROM users"); // Store result set in memory mysqli_store_result($conn); // Loop through result set and output data while ($row = mysqli_fetch_assoc($result)) { echo "Name: " . $row["name"] . ", Email: " . $row["email"] . "In this example, we connect to a database using mysqli_connect() and execute a SELECT statement using mysqli_query(). We then store the result set in memory using mysqli_store_result() and loop through the rows using mysqli_fetch_assoc() to output the name and email of each user. The mysqli_store_result() function is part of the mysqli extension, which is included with PHP as a standard package.
"; } // Close database connection mysqli_close($conn);