Jump to content

Unknown ODBC error message


Darklink

Recommended Posts

I'm trying to build a query with fulltext using the ODBC functions.

I executed the query in phpMyAdmin and made a quick side-script to test the query and they both worked absolutely fine, however when I use the query in a larger script it seems to fall and returns me an error message saying it can't find an error message:

 

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

 

I cannot find this error message anywhere online. Why on god's earth is this happening when practically the same code is working on a different file.

 

Here is the code. You could try it out for yourself, but it will work for you.

 

$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;

}

 

It returns 2 rows successfully, but cannot put them into an array for me.

 

When I take away the * from the fields to select it works but doesn't return the fields I want it to. Only the relevance.

 

I just need someone to explain to me why I could be receiving such error!

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/142620-unknown-odbc-error-message/
Share on other sites

 

I executed the query in phpMyAdmin and made a quick side-script to test the query and they both worked absolutely fine, however when I use the query in a larger script it seems to fall and returns me an error message saying it can't find an error message:

 

 

If you use phpMyAdmin why not use the mysql_* functions instead of odbc functions.

That's what phpmyadmin does anyway. Or do you need to access a microsoft database?

I use ODBC functions because I need to access various databases and so I made myself an ODBC framework to save a lot of hassle in that area.

I am using this specific query on a MySQL database however and I cannot work out why this is happening.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.