0
I am trying to make a login system between PHP and SQL Server and is giving the error Resource(7) of type (SQL Server Statement).
index php.
<form class="form-horizontal" id="FormLogin" action="login.php" method="post">
<div class="form-group">
<label for="login">Login</label>
<input type="text" class="form-control" id="login" name="login" placeholder="Entre com o seu Login">
</div>
<div class="form-group">
<label for="senha">Senha</label>
<input type="password" class="form-control" id="senha" name="senha" placeholder="Entre com a sua Senha">
</div>
<button type="reset" class="btn btn-default">Limpar</button>
<button type="submit" class="btn btn-danger pull-right">Entrar</button>
</form>
login.php
<?php
include 'conexao.php';
include 'banco-usuario.php';
$usuario = buscaUsuario($conn, filter_input(INPUT_POST, 'login'), filter_input(INPUT_POST, 'senha'));
var_dump($usuario);
php database.
$query = "select * from usuario where login = '{$login}' and senha = '{$senha}'";
//$resultado = mysqli_query($conn, $query); //MySQLi
$resultado = sqlsrv_query($conn, $query); //SQL Server
return $resultado;
}
I don’t know what to do about it. I want to make a system that uses login.
I’m not missing the
sqlsrv_fetch()
ai? as in question– rray
Could be. How would that look? Return sqlsrv_fetch($result);
– fabricio_wm
Yes, it might be a
return sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)
, this will return only one line. If you want to use Prepared statements with sql server see this other reply– rray
Put in a way that I can mark as an answer
– fabricio_wm
Gave error of its form but Return sqlsrv_fetch($result) works.
– fabricio_wm