me dice error Notice: Undefined variable: conexion in C:\xampp\htdocs\deportes\LoginPHP\verificar.ph
Publicado por roberto mendoza (3 intervenciones) el 29/02/2020 15:49:47
que tal tengo una duda me dice que tengo error en la conexion pero ya valide las conexiones y estan bien conectadas
Notice: Undefined variable: conexion in C:\xampp\htdocs\deportes\LoginPHP\verificar.php on line 5
Fatal error: Uncaught Error: Call to a member function query() on null in C:\xampp\htdocs\deportes\LoginPHP\verificar.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\deportes\LoginPHP\verificar.php on line 5
les comparto los archivos
verificar.php
conexion.php
Notice: Undefined variable: conexion in C:\xampp\htdocs\deportes\LoginPHP\verificar.php on line 5
Fatal error: Uncaught Error: Call to a member function query() on null in C:\xampp\htdocs\deportes\LoginPHP\verificar.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\deportes\LoginPHP\verificar.php on line 5
les comparto los archivos
verificar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
@include ("configuracion.php");
if (isset($_POST['login'])) {
$query = $conexion->query(" SELECT idusuarios FROM usuarios WHERE password='$password' and usuario='$usuario'");
while ($result = $query->fetch_object()) {
if (!empty($result)) {
$_SESSION['password'] = $row['usuario'];
header('location:admin.php');
} else {
echo '<div class="alert alert-warning" role="alert">Datos incorrectos!</div>';
}
}
}
conexion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
if(isset($_POST['enviar'])) {
include ("configuracion.php");
$conexion = new mysqli ($server,$user,$pass,$bd);
if (!$conexion) {
$msg="Conexión imposible. Revise las credenciales de conexión";
} else {
$usuario=!empty($_POST['usuario']) ? $_POST['usuario'] : NULL;
$password=!empty($_POST['password']) ? $_POST['password'] : NULL;
$repassword=!empty($_POST['repassword']) ? $_POST['repassword'] : NULL;
$nombre=!empty($_POST['nombre']) ? $_POST['nombre'] : NULL;
$correo=!empty($_POST['correo']) ? $_POST['correo'] : NULL;
Valora esta pregunta


0