Multiple MySQL queries (msqli) in a php file

0

I have my connection to the bd so

$conn = new mysqli(server,user,pass,mainDataBase);
un procedimiento almacenado que devuelve una tabla
$sql = "call sp_escap()";
$result = $conn->query($sql);
y las imprimo en el label
while ($r=mysqli_fetch_array($result)) {
        echo '<label href="#collapse'.$r['IdEscenarios'].'" class="nav-toggle">'.$r['NombreEsc'].'</label><br>';
      }
       ?>

so far everything is fine but when I want to make another query I get the error

  

Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result

and I have to comment on my first while so that the second query can be executed.

Help please How to do the two consultations in the same file?

    
asked by Luis David De La Cruz Bautista 10.08.2017 в 17:36
source

1 answer

0

INTENDED TO DO IT IN THIS WAY. I hope you help Blessings.

    <?php


            require('conexion.php');

            $consultas="SELECT *  FROM alumnos";

            $resultados=$conectahugo->query($consultas);

            while($columnas=$resultados->fetch_assoc()){

            echo $columnas['id'],' ';
            echo $columnas['nombrep'],' ';
            echo $columnas['descripcion'],' ';
            echo $columnas['precio'],' ';


            echo '<br>';
            }

?>

I THINK THAT WE ALWAYS NEED TO LOOK FOR GOD. =)

    
answered by 11.08.2017 в 01:36