SQL Server output results in "net :: ERR_CONNECTION_RESET" error in PHP
I am dealing with some issues with prepared statements using PDO-ODBC with PHP5.5 and SQL Server 2008.
I can connect to the database using SQL Server 10.0 ODBC Native Client and do some raw queries as I hardcode the value I'm looking for.
The problem occurs when I try to execute prepared requests ... the browser just tells me the page is not available ... The status is not even a 404 error, but it tells me:
(failed)
Net :: ERR_CONNECTION_RESET.
The code I use is:
try {
$pdodb = new PDO('odbc:Driver={SQL Server Native Client 10.0};Server=xx.xx.xx.xx; database=test; UID=idUser; PWD=password');
} catch (Exception $exc) {
echo $exc->getMessage();
}
$name= 'Smith';
$query = "SELECT * FROM users where Name= :name";
$pdodb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$sql = $pdodb->prepare($query);
$sql->bindParam(':name',$name, PDO::PARAM_STR);
$sql->execute();
$response = $sql->fetchAll();
+3
source to share
No one has answered this question yet
Check out similar questions: