I can not show the result of 2 joined SQL queries

0

I want to show the result of these queries, I get the error of:

  

A session had already started - ignoring session_start () in   C: \ wamp \ www \ curso2.0 \ production \ pruebaTusCursos.php on line 3

I removed that error with:

 if(!isset($_SESSION)) 
    { 
        session_start(); 
    } 

But he still does not show me the result of the consultations This is the code:

 <?php

session_start();

include("conexion.php");


$usuario2 = $_SESSION['usuario'] ;

$sql = "SELECT * FROM REGISTRO  WHERE ID_ALUMNOS = '$usuario2'";
$result = $conn->query($sql);
//verificar si existen registros de la busqueda
if($result->num_rows > 0){
    while($row = $result->fetch_assoc()){
        $ID_CURSOS=$row['ID_CURSO'];
    }

    $sql2 = "SELECT * FROM CURSOS  WHERE ID_CURSO= '$ID_CURSOS'";
    $result2 = $conn->query($sql2);
    //verificar si existen registros de la busqueda
    if($result2->num_rows > 0){
        while($row = $result2->fetch_assoc()){
            $ID_CURSO=$row['ID_CURSO'];
            $NOMBRE_C = $row['NOMBRE_C'];
            $DURACION = $row['DURACION'];
            $CATEGORIA = $row['CATEGORIA'];
            $REQUISITOS = $row['REQUISITOS'];
            $DESCRIPCION = $row['DESCRIPCION'];
            $TIPO_CONTENIDO = $row['TIPO_CONTENIDO'];
            $INSTRUCTOR = $row['INSTRUCTOR'];
            $CORREO_INSTRUCTOR = $row['CORREO_INSTRUCTOR'];
            $REGISTRO = $row['REGISTRO'];
            $NO_LECCIONES = $row['NO_LECCIONES'];

            echo"
              <div class='col-md-4 col-sm-4 col-xs-12 profile_details'>
              <form  method='POST' action='vistaGeneralAlumnos.php?msj=' >
                <div class='well profile_view'>
                    <div class='col-sm-12'>
                    <input value='".$ID_CURSO."'  type='hidden' name='id'>
                          <h4 class='brief'><i>  ".$NOMBRE_C."</i></h4>
                          <div class='left col-xs-7'>
                              <h2><strong>Incluye: </strong> ".$DURACION." / ".$NO_LECCIONES."</h2>
                              <p> <strong>Descripcion:".$DESCRIPCION." </strong></p>
                                  <ul class='list-unstyled'>
                                      <li><i class='fa fa-building'></i>Categoria:".$CATEGORIA." </li>
                                      <li><i class='fa fa-phone'></i>Contenido en:".$TIPO_CONTENIDO." </li>
                                  </ul>
                          </div>

                          <div class='right col-xs-5 text-center'>
                          <img src='images/img.jpg' alt='' class='img-circle img-responsive'>
                          </div>
                          </div>


                      <div class='col-xs-12 bottom text-center'>             
                          <div class='col-xs-12 col-sm-12 emphasis'>
                                             
                            <a href=''> <button type='submit' class='btn btn-primary btn-xs'>
                                 <i class='fa fa-user'> </i>Vista General
                              </button></a>
                          </div>
                      </div>
                </div>
              </div>
                </form>";                   
        }
    }
    else{
        echo "NO SE ENCONTRARON CURSOS RELACIONADOS AL ALUMNO...";
    }
}
else{
    echo "NO SE ENCONTRO EL ALUMNO...";
}

     



?>

And here you capture the tables:

REGISTER

COURSES TABLE

    
asked by Leo Tutorials 12.08.2018 в 20:11
source

0 answers