I am doing tests with a local sql server express that I have on my computer.
Then I have xamp installed and in the htdocs folder I have the php code to try to extract data from the database. It gives me the following Error:
Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\php\selectall.php:3 Stack trace: #0 C:\xampp\htdocs\php\selectall.php(3): PDO->__construct ('sqlsrv:Server=D...', 'root', '') #1 {main} thrown in C:\xampp\htdocs\php\selectall.php on line 3
It's probably high as simple as misusing the username and password.
Being local I don't know if I should use the IP I have (172.26.0.93) and I don't know what password.
Use loscalhost and password empty or root
OR use hostname and connection as I do in managment:
PHP code:
<?php
//---------------------------------Consulta Agenda---------------------------------
$pdo = new PDO("sqlsrv:Server=DESKTOP-6C68BFU\SQLEXPRESS;Database=Inventario", "root", "");
$statement = $pdo->prepare("SELECT [NOMBRE]
,[MODELO]
FROM [Inventario].[dbo].[MARCA]");
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($results, JSON_UNESCAPED_UNICODE);
?>