Page 1 of 1

ODBC Unknown Error

Posted: Thu Jan 29, 2009 10:11 am
by Attero
Hi.
I have a problem with executing a query in ODBC, however it has worked in other scripts (including the phpyMyAdmin query editor) (with the exact same code) and makes it stupidly hard to figure out.

I'm using MySQL and PHP with the ODBC. I need to use ODBC because I'm also connecting through to SQL Server under a framework I built.

I need someone to tell me why this error message would appear. It is telling me it cannot find an error message to match the problem that I am having, which is absolutely helpful.
Warning: odbc_fetch_array() [function.odbc-fetch-array]: SQL error: Failed to fetch error message, SQL state HY000 in SQLGetData in C:\...\odbc.php on line 325
If I retrieve the number of rows return it shows that the rows have been returned fine. But fetching the array does not work. Many other queries are working fine.

I am using this in a FULLTEXT search. So here is the query in short:

Code: Select all

 <?php
//....
 
$sql = "SELECT *, MATCH (f_question, f_answer) AGAINST ('established' IN BOOLEAN MODE) AS Relevance FROM tblFaq
WHERE MATCH (f_question, f_answer) AGAINST ('established' IN BOOLEAN MODE) > 0
ORDER BY Relevance DESC";
 
$result = odbc_exec($conn, $sql);
 
while ( $row = odbc_fetch_array($result) )
{
           $rows[] = $row;
}
 
//...
?>
If I remove the *, from the query it works fine but only receives the relevance.

Does anyone have any idea why this would be happening?