Doubt in PHP connection to database [duplicate]

3

I have a question in a PHP code.

My code is generating several alerts:

Anditseemsthatthesameisnotmakingconnectiontothedatabase,becauseI'mhavingitprintsomedataanditdoesnotprintanythingonthescreen.

I'llputhereasnippetofcode:

<?php$conectar=mysqli_connect("localhost","root","") or die ("Erro na conexão");
mysqli_select_db("painel_admin");
?>

<?php
session_start();
$usuariot = $_POST['usuario'];
$senhat = $_POST['senha']; 
include "conexao.php";

$result = mysqli_query("SELECT * FROM usuario WHERE usuario='$usuariot' AND senha='$senhat' LIMIT 1");
$resultado = mysqli_fetch_assoc($result);
if(empty($resultado)){
    $_SESSION['loginErro'] = "Usuário ou senha inválido";
    header ("Location: login.php");
}

?>
    
asked by anonymous 11.07.2017 / 21:35

0 answers