My login validation is giving this error: Fatal error: Call to undefined function sqlsrv_query()
every time I try to login to the site I created. I made the connection to the db SQL SERVER:
<?php
class Conexao
{
private static $connection;
private function __construct(){}
public static function getConnection() {
$pdoConfig = DB_DRIVER . ":". "Server=" . DB_HOST . ";";
$pdoConfig .= "Database=".DB_NAME.";";
try {
if(!isset($connection)){
$connection = new PDO($pdoConfig, DB_USER, DB_PASSWORD);
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
return $connection;
} catch (PDOException $e) {
$mensagem = "Drivers disponiveis: " . implode(",", PDO::getAvailableDrivers());
$mensagem .= "\nErro: " . $e->getMessage();
throw new Exception($mensagem);
}
}
}
define('DB_HOST' , "---");
define('DB_USER' , "--");
define('DB_PASSWORD' , "--");
define('DB_NAME' , "--");
define('DB_DRIVER' , "--");
?>
And the login:
<?php
require_once "config/conexao.php";
if(isset($_REQUEST['valida'])){
$var1 = $_REQUEST['codMont'];
$sql = "SELECT AQUI";
$stmt = sqlsrv_query($conn, $sql);
if(sqlsrv_num_rows ($stmt) > 0 )
{
$_SESSION['codMont'] = $var1;
header('location:home.php');
}
else{
unset ($_SESSION['codMont']);
header('location:index.php');
}
}
?>
But every time I try to login, it gives me this error: Fatal error: Call to undefined function sqlsrv_query()
and I already put the drives:
php_sqlsrv_7_ts_x86.dll
php_pdo_sqlsrv_7_ts_x86.dll
php_sqlsrv_54_nts.dll
php_sqlsrv_53_nts.dll
php_sqlsrv_54_ts.dll
php_sqlsrv_53_ts.dll
My php version: 5.6.14
Does anyone have a solution to my problem?