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

 

Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.