LocalDb and PDo

Oct 24, 2013 at 5:58 PM

I have an issue with PDO and a localdb database connection.
But not with the main driver.

The next code works well:
$conMain = sqlsrv_connect( '(localdb)\v11.0', array( 'Database'=>'mydatabase'));
$tsql = "SELECT ite_id FROM t_items";
$stmt = sqlsrv_query( $conMain, $tsql);
while( $obj = sqlsrv_fetch_object( $stmt))
    echo $obj->ite_id."\n";

But then, it doesn't with a fatal error
$conPdo = new PDO("sqlsrv:Server=(localdb)\v11.0; Database=mydatabase");
None protocols in connection string
Someone have the same thing ????
Or I failed my configuration.

Oct 24, 2013 at 6:17 PM
Shame on me....

Double quotes issue: solution
$conPdo = new PDO('sqlsrv:Server=(localdb)\v11.0; Database=mydatabase');