Name of Variable session according to query variable

0

I want to create variables $_SESSION according to the name of the data that brings me from a query

while ($row = oci_fetch_assoc($validacion)){
    borrado($row["ID_CENTRAL"]);
    $_SESSION['echo $row["ID_CENTRAL"];'] = $row["ID_CENTRAL"];
    conexion($row["ID_CENTRAL"],$row["IP"]);
}

IF someone knows how I can achieve that, thank you Help!

    
asked by Shack 26.10.2018 в 17:06
source

2 answers

0

I already achieved it:

   while ($row = oci_fetch_assoc($validacion)){

        borrado($row["ID_CENTRAL"]);

        ${"text".$row['ID_CENTRAL']}= $row['ID_CENTRAL'];
        $_SESSION["$row[ID_CENTRAL]"] = ${"text".$row['ID_CENTRAL']};

        //echo $prueba. "<br>";                   
        conexion($row["ID_CENTRAL"],$row["IP"]);

    }

echo "$_SESSION["NOMBRE_DE_INFO_DEL_CAMPO"]";

// field

    
answered by 26.10.2018 / 18:48
source
0

You do not need echo , you can do it like this:

while ($row = oci_fetch_assoc($validacion)){
    borrado($row["ID_CENTRAL"]);
    $_SESSION[$row["ID_CENTRAL"]] = $row["ID_CENTRAL"];
    conexion($row["ID_CENTRAL"],$row["IP"]);
}
    
answered by 26.10.2018 в 17:10