ODBC Connection
| From: | Nichols, Mark A. | Date: | Tue, 19 Nov 2002 15:32:51 +0000 |
| Subject: | ODBC Connection | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-17036@lists.php.net to get a copy of this message | ||
I'm not having much luck here.
I've created a MS Access database that has a linked table to an Exchange 2000 public folder.
When I access this database (MS Access) with PHP, it works fine with the table imported, but when
linked to Exchange, PHP returns:
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Not a valid account name or password.,
SQL state 08004 in SQLExecDirect in C:\FoxServ\www\linkdata\testme.php on line 11
Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in
C:\FoxServ\www\linkdata\testme.php on line 13
Here's the code, any ideas.
<?
$user = "";
$password = "";
$dsn="exchlink";
if (!($conn = @odbc_connect($dsn,$user,$password)))
{
echo "Could not connect to the database at this time.";
exit();
}
$sql = "SELECT Company,Last,First from sgcontacts ORDER BY Company,Last,First";
$result = odbc_exec($conn,$sql);
while (odbc_fetch_row($result))
{
$company = odbc_result($result,"Company");
$last = odbc_result($result,"Last");
$first = odbc_result($result,"First");
echo $company . " " . $last . " " . $first . "<br>";
}
?>