pls: Error Sessions php !


#1

Hi, I am doing a mobile application and I require the use of web service, in order to pass data in a better way I require to use sessions, what happens is that I save the sessions in the first php and I see if I keep in them and it contains the data, but when I do the query in the second php then it says “undefined index: rutTecnico”, beforehand thank you very much.

Theres is my code

First_php:

<?php session_start(); //Llamar conexion require_once('Connection.php'); mysqli_set_charset($con, "utf8"); $data = json_decode(file_get_contents('php://input'), true); $buscar = $data["Rut"]; $sql = "SELECT Tecnico.Nombre, Tecnico.Rut, cms_User.Password FROM Tecnico INNER JOIN cms_User ON Tecnico.Correo = cms_User.Id WHERE Rut='$buscar'"; if(!$resulta = mysqli_query($con, $sql)) die(); $json_array = array(); while($row = mysqli_fetch_assoc($resulta)) { $json_array['Usuarios'][] = $row; $ruG = $row['Rut']; $noG = $row['Nombre']; } $_SESSION['rutTecnico'] = $ruG; $_SESSION['nombreTecnico'] = $noG; echo json_encode($json_array); //Cerrar conexion mysqli_close($con); ?>

Second_PHP

<?php session_start(); $rut = $_SESSION['rutTecnico']; $nombre = $_SESSION['nombreTecnico']; $json_array = array("Tecnico" =>["Rut"=>"$rut","Nombre"=>"$nombre"]); echo json_encode($json_array); ?>

#2

Check if there is a tmp folder in your root directory :slight_smile: