I'm looking for a way to keep in $ _SESSION two or more rows of records that are thrown by a mysql query, and then use those results in other queries. I usually pulled a single record row with:
while($row=mysql_fetch_array($consultar))
{
$_SESSION["cedula"]=$row["cedula"];
$_SESSION["nombre"]=$row["nombre"];
$_SESSION["apellido"]=$row["apellido"];
}
but that would only keep one row in session now I need you to keep several rows in session of this query:
$consultar=mysql_query("SELECT * from asignacion where cedula='$_SESSION[cedula]'");
$num=mysql_num_rows($consultar);
if($num==0)
{
echo "<script>alert('¡NO HAY EQUIPOS ASIGNADOS A ESTE EMPLEADO!')</script>";
echo "<meta http-equiv='refresh' content='0; url=../vista/devolucion.php'>";
}else{
while($row=mysql_fetch_array($consultar))
{
$_SESSION["id_case"]=$row["id_case"];
$_SESSION["periferico1"]=$row["periferico1"];
$_SESSION["periferico2"]=$row["periferico2"];
$_SESSION["periferico3"]=$row["periferico3"];
$_SESSION["id_laptop"]=$row["id_laptop"];
}
echo "<script>alert('¡ENCONTRADO!')</script>";
}
and be able to use it to generate a dynamic table with those records found
<?php
$sqlQuery = mysql_query("SELECT * from equipo where id_case='$_SESSION[id_case]'");
$table = $sqlQuery or die(mysql_error());
if ($table) {
?>
but everything is dynamic, you do not know how many records the user will make, I hope you can help me and thanks in advance