sql >> Database >  >> RDS >> Mysql

PHP SESSION-variabelen gebruiken om MySQL-queryresultaten op te slaan

Sla de huidige array op in sessie:

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


  1. PostgreSQL DISTINCT ON met verschillende ORDER BY

  2. Hoe kan ik debuggen waarom de eenvoudigste MySQL-query false retourneert?

  3. MYSQL-server is verdwenen

  4. Orbeon Forms Postgres DB-verbinding