Jump to content

PHP, ODBC, SQL Server Select Statement Options


dkirk

Recommended Posts

I am having a problem getting results back from a SELECT statement

using the script below. The field names contain decimals and spaces and I am not

sure wether or not this is causing the problem?? I am

connecting to a SQL server db using ODBC, first time connecting to SQL

server but have been using ODBC to connect to Access db's for years. I

have entered the field names just as they are in the table and I have

tried replacing the spaces and decimals with underscores but still

recieve the same error. Anyway, my simple script and the error that I

am recieveing is below. Any help would be greatly appreciated..

 

$connect = odbc_connect('cabngsql', '', '');

if (!$connect)

{

        echo "couldn't connect";

        exit;

 

 

}

 

 

$query1 = "SELECT fol no FROM Protocol.folder";

$result1 = odbc_exec($connect, $query1);

while (odbc_fetch_row($result1)){

          $folder = odbc_result($result1, 1);

          echo "$folder";

  }

?>

 

ERROR: SQL error: [Microsoft][ODBC SQL Server Driver][sql

Server]Invalid object name 'Protocol.folder'., SQL state S0002 in

SQLExecDirect

 

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.