MySQL Forums
Forum List  »  Newbie

SQL synatax problem
Posted by: Paul Mclellan
Date: July 03, 2005 08:09AM

Hi i'm slightly new to sql and i am having a few problems with a search facility on my webpage.
I work for a company which has asked my to set up a ecommerce web site for them. The whole site has been designed by someone else and not me, all i am doing id uplading the php files and then set up the mysql databse.

Anyway the problem:

I have a search facility on the site which searches for book titles, authors and isbn numbers.

When i search on an author i get this error.

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') against (' dfdf ') as relevance,if(book_pub_year <= NOW(),'N


now in the php page i have pin pointed the error to this part


case "author":
$table_name = 'book_info';
$fulltext_key = get_fulltext_key($table_name,$dbcnx);
$sql = "SELECT book_fauthor, book_lauthor, book_description, book_title, book_extra_top, book_isbn, book_co_author, \n"
.boolean_sql_select(boolean_inclusive_atoms($keywords), $fulltext_key)." as relevance,if(book_pub_year <= NOW(),'Now Available',DATE_FORMAT(book_pub_year,'%b %Y')) as pub_date, book_out_of_print \n FROM $table_name \n WHERE \n"
.boolean_sql_where($keywords,$fulltext_key)." \n HAVING relevance>0 \n ORDER BY relevance DESC\n";
echo("\n\n<!-- SQL: $sql -->\n\n");
$sql_num = mysql_query($sql) or redirect("search_results.php");
$sql_results = mysql_query($sql . $sql_num_end_author) or die(mysql_error());
$parsed_as = "<BR>Parsed the following search as: " . boolean_parsed_as($keywords);
break;


The funny thing is, this site is working on our sister company server but not on our. I have a feeling it is to do with the version.
the version i am using is 3.32 (it think).


Thanks in advance for any help

Paul

Options: ReplyQuote


Subject
Written By
Posted
SQL synatax problem
July 03, 2005 08:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.