$result = mysqli_query($connection, "SELECT * FROM my_table"); $data = mysqli_fetch_all($result, MYSQLI_ASSOC);
$result = mysqli_query($connection, "SELECT name, age FROM my_table WHERE age > 25"); $data = mysqli_fetch_all($result, MYSQLI_ASSOC);In this example, we are using the mysqli_query function to run a SQL query that selects the names and ages of all users whose age is greater than 25. The `mysqli_fetch_all` function is then used to fetch all the data from the result set and store it in an associative array. The package library for using the PHP database getResult function would depend on the database you are using. For example, for MySQL databases, you would use the MySQLi or PDO MySQL extensions, while for PostgreSQL databases you would use the PDO PostgreSQL extension.