Hello I'm hardly new to PHP and Mysql I want to make a query with the result of another query arrar
<?php
session_start();
if (isset($_SESSION[' u_usuario'])){
$usuario1 = $_SESSION[' u_usuario'];
}
else{
header("Location: index.php");
}
include("conexion.php");
$refcuatri = " II2018 "; //Cambiar cuatrimestre para prevenir errores
//busqueda por del alumno por cuatrimester y matricula
$query3= mysqli_query($conexion,"SELECT refgrupo, refcarrera FROM inscripcion WHERE refcuatri='$refcuatri' AND matricula ='$usuario1'");
$q3 = mysqli_fetch_array($query3);
$refgrupo=$q3['refgrupo']; // es igual a 4-A
$refcarrera=$q3['refcarrera']; //es igual a SI
//busqueda del profesr por referencia del grupo y referencia de la carre que anteriormente se habia creado las variables
//A PARTIR DE AQUI NO ME LEE LAS VARIABLES PARA HACER OTRA CONSULTA
$query4= mysqli_query($conexion,"SELECT refprofesor FROM asigna_materia WHERE refgrupo='$refgrupo' AND refcarrera='$refcarrera'");
$q4 = mysqli_fetch_array($query4);
$refprofesor=$q4['refprofesor']; //NO DA VALOR
echo $refgrupo; // ES IGUAL A 4-A
echo $refcarrera; // ES IGUAL A SI
echo $refprofesor; // NO DA VALOR
?>
And that is the result but from the query4 does not take the variables the information that has inside it to do another search someone could help me: c
the fields are correct!