Databases and PHP
| From: | Ankit Bhardwaj | Date: | Mon, 31 Aug 2009 12:07:34 +0000 |
| Subject: | Databases and PHP | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-5763@lists.php.net to get a copy of this message | ||
I am trying to use PHP inner join through ODBC with access database.
Here is my php coding :
<?php$excelFile = realpath('../db/feedback.mdb');$excelDir = dirname($excelFile);$conn
= odbc_connect("Driver={Microsoft Access Driver
(*.mdb)};DriverId=790;Dbq=$excelFile;DefaultDir=$excelDir" , '', '');
if (!$conn) {exit("Connection Failed: " . $conn);}
$rs=odbc_exec($conn,"SELECT friends.friendName,friends.Online FROM friends inner join chat on
(friends.username='ankit') and (friends.username=chat.username or
friends.username=chat.email) WHERE friends.online='Offline' and (friends.friendName like
'%a%' or friends.friendEmail like '%a%')");
if (!$rs) {exit("Error in SQL");}while (odbc_fetch_row($rs)) { echo odbc_result($rs,1) .
" "; echo odbc_result($rs,2) . " "; echo odbc_result($rs,3) . "
"; echo "<br>"; }odbc_close($conn);?>
Here is the ERROR:
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Join
expression not supported., SQL state S1000 in SQLExecDirect in
D:\wamp\www\ALL_IN_ONE\wwwroot\index.php on line 9Error in SQL
Any help would be much appreciated.
_________________________________________________________________
Log on to MSN India for a lowdown on what’s hot in the world today
http://in.msn.com