Lagra den faktiska arrayen i session:
File1.php:
$query = //my query.
$result = array();
$res = mysqli_query($conn, $query);
while($row = mysqli_fetch_array($res, MYSQL_NUM){
$result[] = $row;
}
$_SESSION['query2'] = $result;
File2.php:
//I have already done session_start(); and initialized $conn
$tempArray = $_SESSION['query2'];
var_dump($tempArray);