php-sqlsrv/test/bvt/pdo_sqlsrv/msdn_pdoStatement_errorCode.phpt

21 lines
517 B
Plaintext
Raw Normal View History

2017-06-03 00:59:44 +02:00
--TEST--
shows the error code of a SQL query with a mispelled table
--SKIPIF--
<?php require('skipif.inc'); ?>
2017-06-03 00:59:44 +02:00
--FILE--
<?php
require('connect.inc');
$conn = new PDO( "sqlsrv:server=$server; Database = $databaseName", "$uid", "$pwd");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
2017-06-03 00:59:44 +02:00
$stmt = $conn->prepare('SELECT * FROM Person.Addressx');
$stmt->execute();
echo "Error Code: ";
print $stmt->errorCode();
// free the statement and connection
unset($stmt);
unset($conn);
2017-06-03 00:59:44 +02:00
?>
--EXPECT--
Error Code: 42S02