Warning: mysqli_query () expects parameter 1 to be mysqli, null given

0

I have the following code:

  <?php
include("conectar.php");
$conex        = f_conectar();
$cod_est      = $_GET['cod_est'];
$nombre_est   = $_GET['nombre_est'];
$apellido_est = $_GET['apellido_est'];
$curso_est    = $_GET['curso_est'];
$paralelo_est = $_GET['paralelo_est'];
$edad_est     = $_GET['edad_est'];
$dir_est      = $_GET['dir_est'];
$telf_est     = $_GET['telf_est'];
$result       = mysqli_query($conex, "INSERT INTO estudiantes (cod_est,nombre_est,apellido_est,curso_est,paralelo_est,edad_est,dir_est,telf_est)
     VALUES($cod_est,'$nombre_est','$apellido_est','$curso_est','$paralelo_est',$edad_est,'$dir_est',$telf_est)");
if ($result) {
    echo "Sus datos fueron guardados";
    echo "<br><a href='formulario.html'>Volver</a>";
} else {
    echo "Sus datos no fueron guardados.Error.";
    exit;
}
mysqli_close($conex);
?>

And he throws me the following error.

  

Successful connection Warning: mysqli_query () expects parameter 1 to be        mysqli, null given in C: \ xampp \ htdocs \ principal.php on line 12 Your        data was not saved.Error.

    
asked by Jefferson Diaz 10.04.2018 в 09:35
source

0 answers