sql >> Base de Datos >  >> RDS >> Mysql

Uso de PHP SESSION Variables para almacenar resultados de consultas MySQL

Almacene la matriz real en la sesión:

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);