help with logueo presents problems with the BD php connection working with xammp and sublime text

0

I'm making an initial user verification page, with their respective passwords. This information is extracted from a table in the MySQL database. I made the connection to the database correctly, and when making the connection or trying the file "index.php" I get the following error:

  

does not show if it is connected.

connections.php

<?php
$conexion = new mysqli("localhost","root","admin123","trujii")

    if($conexion)
    {
        echo "conexion exitosa";

        else
        {
            echo "conexion no exitosa";
        }
    }

?>

index.php

<!DOCTYPE html>
<html>
<head>
    <title>index</title>
</head>
<body>
    <center>
        <br/><br/>
        <form action="proceso.php" method="POST">
            <input type="text" name="usuario" value="" placeholder="usuario..."/>
            <input type="password" name="contrasena" value="" placeholder="contrasena..."/>
            <input type="submit" value="aceptar"/>
        </form>

    </center>

</body>
</html>

proces.php

<?php
    session_start();

    $usuario = $_POST['usuario'];
    $contrasena = $_POST['contrasena'];

    include("conexion.php");

    $proceso = $conexion->query("SELECT * FROM admin WHERE user = '$usuario' AND pw = '$contrasena'"); 

        if ($resultado = mysqli_fetch_array($proceso)) 
        {

            $_SESSION['u_usuario'] = $usuario;
            //header("Location: sesion.php");
            echo "sesion exitosa";
        }
             else
            {
                //header("Location: index.php");
                echo "sesion no exitosa";
            }

?>
    
asked by cristian trujillo 07.03.2018 в 17:25
source

1 answer

0

in your sql statement try putting $proceso = $conexion->query("SELECT * FROM admin WHERE user = '".$usuario."' AND pw = '".$contrasena."'"); concatenate the user variable and password in your sql. I hope I help you

    
answered by 07.03.2018 в 17:34