You can use mysqli::multi_query. As an example,
$query = "SELECT CURRENT_USER();"; # Example Query
$query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5"; # Second Example Query
/* execute multi query */
if ($mysqli->multi_query($query)) {
do {
/* store first result set */
if ($result = $mysqli->store_result()) {
while ($row = $result->fetch_row()) {
printf("%s\n", $row[0]);
}
$result->free();
}
/* print divider */
if ($mysqli->more_results()) {
printf("-----------------\n");
}
} while ($mysqli->next_result());
}
/* close connection */
$mysqli->close();
Since StackOverflow is not a code writing service, I am not going to write how this is going to happen in your case. Try to reflect it to your code, when you face problems, post a question.
Note: Example is from the link provided of the whole documentation of mysqli::multi_query.
Good Luck!