Good afternoon, I do not have much experience in php I'm starting now with this language and I'm having a problem with two functions follow problem print:
Warning: sqlsrv_query () expects parameter 1 to be resource, boolean given in ... daoLogin.php on line 17
Warning: sqlsrv_num_rows () expects parameter 1 to be resource, boolean given in ... daoLogin on line 19
and the code:
<?php
$server = "Filipe-PC\SQLExpress";
$database = "bd_CaminhoVerde";
$user = "caminho_verde";
$pass = "greenway";
$infoConexao = array("Database" => $database, "UID" => $user, "PWD" => $pass);
$conectar = sqlsrv_connect($server, $infoConexao);
$usuario = $_POST['txtUsuario'];
$senha = $_POST['txtSenha'];
$queryLogar = "execute usp_logar @usuario = ?, @senha = ?";
$parameter = array($usuario, $senha);
$query_Resultado = sqlsrv_query($conectar, $queryLogar, $parameter);
if(sqlsrv_num_rows($query_Resultado) > 0)
{
session_start();
$array_Resultado = mssql_fetch_array($query_Resultado);
$_SESSION['cpf'] = $array_Resultado['cpf'];
$_SESSION['nome'] = $array_Resultado['nome'];
$_SESSION['creditos'] = $array_Resultado['creditos'];
$_SESSION['usuario'] = $array_Resultado['usuario'];
header("Location:home.php");
}
else{ }
?>
Thank you for your attention right away
Note: already extracts the drivers from php_sqlsrv_56_ts and php_pdo_sqlsrv_56_ts and from php.ini referencing
Error Array with sql-server:
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Nome da fonte de dados n�o encontrado e nenhum driver padr�o especificado [message] => [Microsoft][ODBC Driver Manager] Nome da fonte de dados n�o encontrado e nenhum driver padr�o especificado ) )