Thanks for the reply.
When it didn't work, I downloaded and installed the mdac 2.6 and
the up to date jet service pack. Still no joy.
$DBConn is coming back as integer 1 so that seems ok.
I have tested the DSN using MSQuery and it is connecting ok.
I have also turned tracing on for the dsn and the trace says
that it connects successfully but then nothing else.
I am a bit lost after this. Anyone any suggestions?
Thanks,
Colum
Original Message:
-----------------
From: [EMAIL PROTECTED] (Miles Thompson)
Date: Mon, 25 Jun 2001 18:22:52 -0300
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Database access using ODBC
Colum,
Did you check out www.php.net/odbc_Exec
One of the solutions posted in the comments was to download and install a
new ODBC driver from MSFT. Are you getting a valid integer returned to
$DBConn?
NOt worked with this, but I hope those are helpful suggestions - Miles Thompson
At 08:38 AM 6/25/01 -0400, [EMAIL PROTECTED] wrote:
>Hi,
>
>Long time reader, first time poster! I am new to php coming from
>a generally MS (unfortunately) background (Access, VB, SQLServer)
>and I am looking to branch out a bit.
>
>I have a client who wishes to have an internet front-end to an
>Access database. I am using php with odbc to access this and (as
>I am a newbie), I am having problems with the connection. After
>I do an odbc_pConnect, when I call the odbc_exec, I get the usual
>error, Warning: Supplied agrument is not a valid ODBC-Link resource.
>
>The ODBC DSN is setup as standard (no default login etc). The
>following code is being used for db access:
>
>function DBRetrieve($pSQLStr)
>{
> global $DBConn, $DBQryID, $DBQryRows, $DBQryColumns;
>
> $DBDsn='PHPTEST';
> $DBUser='Admin';
> $DBPassword ='';
>
> #Open a persistent connection to the database
> if (!$DBConn = (odbc_pConnect($DBDsn, $DBUser, $DBPassword) or
> die("Database Execution Error: " . odbc_Error() . " " . odbc_ErrorMsg())))
> {
> echo "\nError connecting to database\n";
> return false;
> }
>
> #Send query to database
> if (!$DBQryID=(odbc_Exec($DBConn, $pSQLStr) or die("Database Execution
> Error: " . odbc_Error() . " " . odbc_ErrorMsg())))
> {
> echo "\nError executing database request: [ODBC_EXEC]\n";
> DBDestroy();
> return false;
> }
>
> #Get no of rows in recordset
> if (!$DBQryRows=(odbc_num_rows($DBQryId) or die("Database Execution
> Error: " . odbc_Error() . " " . odbc_ErrorMsg())))
> {
> echo "\nError executing database request: [ODBC_NUM_ROWS]\n";
> DBDestroy();
> return false;
> }
>
> #Get number of fields to display
> if (!$DBQryColumns=(odbc_num_fields($DBQryId) or die("Database
> Execution Error: " . odbc_Error() . " " . odbc_ErrorMsg())))
> {
> echo "\nError executing database request: [ODBC_NUM_FIELDS]\n";
> DBDestroy();
> return false;
> }
>
> return true;
>}
>
>Does this look ok to you more experienced guys? Am I missing
>something or is there a better way?
>
>Thanks.
>
>Colum
>
>--------------------------------------------------------------------
>Mail2Web - Check your email from the web at
>http://www.mail2web.com/ .
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]