I want to save the result of a query in $_SESSION
, but when I try to retrieve the query from $_SESSION
, the error occurs
"Could not fetch mysqli_result".
Note: I use session_start()
. Here is the code:
Query mysql:
$user_types = $mysqli->query("SELECT tipo from tipo_usuario WHERE usuario = '$user_id' ORDER BY tipo");
Placing the result in $ _SESSION:
$_SESSION['user_types'] = $user_types;
When I try to retrieve the query by $_SESSION
, here is the error:
while($row = $_SESSION['user_types']->fetch_array())