Empty page when running sql command

Asked

Viewed 128 times

0

When I run the index.php page, there is a form that goes to the login.php page

When the login page is executed it is completely blank, does not execute anything.

The Code is as follows:

<?php
include_once("../../conf.php");

$mysqli = mysqli_connect(HOST,user,PASS,DB) or die (mysqli_error());

$login = $_POST['login'];
$senha = $_POST['senha'];

if ($prep = $mysqli->prepare("SELECT * FROM Admin WHERE login=? AND password=?")) {
    $prep->bind_param('ss',$login,$senha);
    $prep->execute();

    if ($prep->error) {
        echo "erro";
    } else {
        echo "ok";
    }
} else {
    echo "erro 2";
}

The directory where conf.php exists, is a simple database connection using mysqli_connect.

What might happen? Neither an error message nor anything..

  • 2

    Add these lines at the beginning of the file: ini_set('display_errors', true); error_reporting(E_ALL); Then post the error.

  • It doesn’t show up at all...

  • Directly access the file conf.php see if there are no errors in it, add those two lines in it as well.

  • Some of these answers answered him?

2 answers

1

Hello.

Try the following:

Where do you have the mysqli_connect simply put new mysqli.

0

Not missing something like:

printf("%d Row inserted.\n", $stmt->affected_rows);

See the official documentation: Documentation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.