[RESOLVED] right syntax to use near ' IN BOOLEAN MODE
Results 1 to 4 of 4

Thread: [RESOLVED] right syntax to use near ' IN BOOLEAN MODE

  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    66

    resolved [RESOLVED] right syntax to use near ' IN BOOLEAN MODE

    Hi:

    This is the code I used:

    PHP Code:
    <html> 
    <head><title>processform</title> 
    </head> 
    <body> 
    <?php 

    // include MySQL-processing classes 

    $var = @$_GET['q']; 
    $trimmed trim($var); 
    // connect to MySQL 

    $dbhost "db.db.xxxxxxx.abc.com"
    $dbname "dbname"
    $dbuser "dbuser"
    $dbpass "password"

    $link mysql_connect($dbhost$dbuser$dbpass); 
    if (!
    $link) { 
    die(
    'Could not connect: ' mysql_error()); 


    $db_selected mysql_select_db('dbname'); 
    if (!
    $db_selected) { 
    die(
    'Could not select database: ' mysql_error()); 


    $keyword mysql_real_escape_string($_POST['keyword']); 

    // Perform the fulltext search 





    $sql "SELECT productID, ArtistName, year, Genre, TypeOfDisc, Price, image
    FROM searches WHERE MATCH(ArtistName) AGAINST ('
    $keyword', IN BOOLEAN MODE)
    LIMIT 0 , 30"
    ;
    $query mysql_query($sql) or die(mysql_error()); 
    $row_sql mysql_fetch_assoc($query); 
    $total mysql_num_rows($query); 


    if(
    $total>0) { 
    while (
    $row_sql mysql_fetch_assoc($query)) {//echo out the results 
    echo ''.$row_sql['ArtistName'].'<br />'.$row_sql['Price'].''

    } else 

    echo 
    '<div class="maincontainer"><h2>No results were found, Go 
    back and try a new search.</h2></div>'
    .''



    echo 
    '</div>'

    ?> 
    </body> 
    </html>

    This is the error I got:

    PHP Code:
    You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near ' IN BOOLEAN MODE) LIMIT 0 , 30' at line 2 
    Can someone please help? Thanks

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    Remove the comma in the AGAINST() part of the query - there should be no comma between the search term and the search_modifier section (as shown on the MySQL manual page for the MATCH... AGAINST syntax).

  3. #3
    Member
    Join Date
    Sep 2011
    Posts
    66

    Not searching properly

    At the outset Thanks a bunch for the previous reply. It removed the error immediately and gave me the error message that was in the Code " No results were found, Go back and try a new search.".

    However, it gives the same message no matter what I search for, even for words I know are in the DB.

    Please help

  4. #4
    Member
    Join Date
    Sep 2011
    Posts
    66
    Quote Originally Posted by pnarendran View Post
    At the outset Thanks a bunch for the previous reply. It removed the error immediately and gave me the error message that was in the Code " No results were found, Go back and try a new search.".

    However, it gives the same message no matter what I search for, even for words I know are in the DB.

    Please help
    the Html Code I use is :
    PHP Code:
    <form method="get" action="processform.php">


    <
    div style="display:inline-block; width: 270px; overflow:hidden;"></div>
    <
    input name="searchterm" type="text"  size="55" class="searchbox" title="What service are you looking for ?" value="What service are you looking for ?" width="445px" />


    <
    input type="submit" name="search" title="Search Now!
    "
    value="Search" class="searchbutton" /> </div>

    </
    form

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •