odbc and inner joins...

From: Date: Tue, 25 Aug 2009 05:33:20 +0000
Subject: odbc and inner joins...
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-5724@lists.php.net to get a copy of this message
I'm trying to use with a select statement that uses inner joins. When I type the Select statement directly into the query window for MSSQL the query runs fine. I use the same select statement through odbc it doesn't work. This only happens when I add the inner join on my select statement. If I don't use a inner join through odbc I can get a connection and a recordset returned so my connection works fine. I add the inner join and It isn't working. The inner join is joining two tables from the same database. Here is my select statement: $db_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("../db/feedback.mdb").";"; $db_conn->open($connstr); $sql="select * from friends as f inner join chat as c on f.username='Ankit' and (f.username=c.username or f.username=c.email) where f.online='Available' and (f.friendName like '%a%' or f.friendEmail like '%a%')"; $rS = $db_conn->execute($sql); $f2 = $rS->Fields(2); $f4 = $rS->Fields(4); while(!$rS->EOF) {............................................................$rS->MoveNext();}If I leave out everything after the INNER JOIN the select statement works. Any help would be much appreciated. _________________________________________________________________ One stop at MSN India to catch up with what’s hot in the world around you today http://in.msn.com

« previous php.webmaster (#5724) next »