Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.