$query = "SELECT * FROM users"; $result = $mysqli->query($query); $rows = $result->fetch_all(MYSQLI_ASSOC);
$query = "SELECT * FROM users WHERE age > ?"; $stmt = $mysqli->prepare($query); $stmt->bind_param("i", $age); $stmt->execute(); $rows = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
$query = "SELECT * FROM users"; $stmt = $pdo->prepare($query); $stmt->execute(); $rows = $stmt->fetch_all(PDO::FETCH_ASSOC);This code retrieves all rows from the "users" table in the database using PDO and stores them in the $rows variable as an array of associative arrays. Package library: PDO.