Hi
I am trying to extract some data from a SQL Sever database via PHP using the Microsoft Drivers for PHP for SQL Server. Some tables I can retrieve fine but others give the following error message:
Array ( [0] => Array ( [0] => 42S02 [SQLSTATE] => 42S02 [1] => 208 [code] => 208 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'xyz$Permanent Assignments'. [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'xyz$Permanent Assignments'. ) )
If I try and run the same statement from isql (SELECT * FROM [xyz$Permanent Assignments]) using the same credentials it works fine so I know that the statement is correct and the object does exist.
I have also tried with version 1 and 2 of the MS drivers.
The code is below but if I try other tables it works - it's all a bit hit and miss.
$tsql = "SELECT *
FROM [".$client."\$Permanent Assignments]";
print $tsql;
$stmt = sqlsrv_query( $conn, $tsql);
if ( $stmt )
{
echo "Statement executed.";
}
else
{
echo "Error in statement execution.
\n";
die( print_r( sqlsrv_errors(), true));
}
Anyone got any ideas?
Thanks