1
I need to pull the value of the 'level' that is in the bank because I am setting in some pages the question of access permission , only that I am not able to pull this data from the table . Can someone please help me ?
Follow my connection code :
<?php
session_start();
$serverName = "";
$connectionInfo = array( "Database"=>"", "UID"=>"", "PWD"=>"" );
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn === false) {
die(print_r(sqlsrv_errors(), true));
}
$user = $_POST['email'];
$password = $_POST['password'];
$query = ("SELECT LOGIN,SENHA,NIVEL FROM NOME_TABELA WHERE LOGIN LIKE '$user' AND SENHA LIKE '$password'");
$params = array();
$options = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
$stmt = sqlsrv_query($conn, $query, $params, $options);
$row_count = sqlsrv_num_rows($stmt);
if ($row_count > 0) {
session_start();
$_SESSION['email'] = $user;
$_SESSION['password'] = $password;
header('location:inicio.php');
}
else {
//Destrói
session_destroy();
//Limpa
unset ($_SESSION['email']);
unset ($_SESSION['password']);
//Redireciona para a página de autenticação
header('location:index.php');
}
?>
Friend, put the code in the question and not a print
– renanvm
I was not knowing how to format so I had sent via photo , but it has been changed
– Foloni
can better explain the "I’m not getting to pull this dice from the table"? what happens, some mistake?
– Ricardo Pontual
So, I have 3 columns in my table ( User / password / level ) I need the variable "level" that is associated with the user in order to be able to restrict access in some pages. Only I can’t pull this value . It does not return to anything . to learning PHP now , I’m kind of layman . Ai to hit me to pull this data .
– Foloni