How can multiple results be obtained using mysql_query in PHP?

When using mysql_query in PHP, it is not possible to retrieve multiple results with a single query. One way to work around this limitation is to execute multiple queries sequentially and store the results in an array. This can be achieved by using a loop to execute each query and fetch the results into an array.

// Connect to the database
$conn = mysql_connect("localhost", "username", "password");
mysql_select_db("database_name", $conn);

// Array to store results
$results = array();

// Array of queries
$queries = array("SELECT * FROM table1", "SELECT * FROM table2");

// Execute each query and store results in the array
foreach($queries as $query) {
    $result = mysql_query($query);
    $data = array();
    while($row = mysql_fetch_assoc($result)) {
        $data[] = $row;
    }
    $results[] = $data;
}

// Print out the results
print_r($results);

// Close the connection
mysql_close($conn);