I have a database that is allready setup and can not be changed due to ERP software running on it. When trying to connect to retrieve some data into a table in PHP, i get the following error:
[SQL Server]Invalid object name 'Lareco Live'
I understand that this is due to the space in the tablename --> [Lareco Live$Lead]
This is my script:
// Establishes the connection
$dbh = sqlsrv_connect($serverName, $connectionOptions);
if ($dbh === false) {
echo "Error (sqlsrv_connect): ".print_r(sqlsrv_errors(), true);
exit;
}
$sql = "select No_, Description from [Lareco Live$Lead] with (nolock) ";
$getResults = sqlsrv_query($dbh, $sql);
if ($getResults === false) {
echo "Error (sqlsrv_query): ".print_r(sqlsrv_errors(), true);
exit;
}