Problem fixed!

Thank you to David who pointed out that I had my variables switched in the
in the odbc_exec and odbc_cursor lines.  For ODBC, the connection variable
comes first (the opposite of MySQL).

Bev

----------------------
Beverly Steiner
[EMAIL PROTECTED]


-----Original Message-----
From: Beverly Steiner [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 1:58 PM
To: PHPDB
Subject: FW: [PHP-DB] problem connecting w/ODBC


Hello again,

Does anyone have suggestions about where I can get an answer to the problems
I'm having with ODBC?  I've tried using:
        $cursor = odbc_cursor($connection) || die("cannot create cursor");

and get a similar error:

Warning: odbc_cursor(): supplied resource is not a valid ODBC result
resource in c:\program files\apache group\apache\htdocs\test4.php on line 13
cannot create cursor

Any help would be greatly appreciated.  I've been trying unsuccessfully to
access to an MS Access database with PHP for weeks now.  Any ideas of where
I can get the answer?  I have posted to the PHP-INST and PHP-DB lists.

----------------------
Beverly Steiner
[EMAIL PROTECTED]


-----Original Message-----
From: Beverly Steiner [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 7:13 PM
To: PHPDB
Subject: [PHP-DB] problem connecting w/ODBC


Hello,

I am having problems accessing a database through ODBC.  I first sent an
email describing my problems accessing an MS Access database through PHP.
Today I installed MySQL.  I have no problems accessing my test database with
the mysql commands.  I downloaded MySQL's ODBC driver.  I get the same error
message trying to access this database w/ODBC as I did with the MS Access
database.

I am running Windows XP Professional, PHP 4.3.1, and Apache 1.3.27.

Here's my PHP code:

$connection = odbc_connect("testmysql", "", "")  or die ("Couldn't connect
to the server.");

$sql = "SELECT * FROM member";

$result = odbc_exec($sql,$connection) or die ("Couldn't execute query");

I get the following error message in my browser:

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in
c:\program files\apache group\apache\htdocs\test4.php on line 17
Couldn't execute query

Anyone have any ideas of what I should do so I can access a database through
ODBC?

----------------------
Beverly Steiner
[EMAIL PROTECTED]



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to