Error While using MATCH() AGAINST() in php mysql -


i'm new in php. trying search mysql dayabase using match against rather using like. using script,

    <?php   if (isset($_get['q'])){          error_reporting(-1);          $query = $_get['q'];          $dbh  = new mysqli($host, $user, $password,  $database);          if ($dbh->connect_error) {             echo 'unable connect database '. $dbh->connect_error;         } else {               if ($stmt = $dbh->prepare("select index, sura, aya, text bn_bengali match(sura,text) against(?) "))                 {                 $stmt->bind_param("s", $query);                  $stmt->execute();                  $stmt->bind_result($index, $sura, $aya, $text);                   $stmt->store_result();               printf("number of rows: %d.\n", $stmt->num_rows);                   while ($stmt->fetch()) {                     echo $sura.'-'.$aya;                     echo $text;                     echo '<hr />';                 }             } else {                    echo "prepare failed: (" . $dbh->errno . ") " . $dbh->error;             }         }   } // end isset q else {      echo '<form action="" ><input type="text" name="q"><button>search</button></form>'; }     ?> 

but it's giving error,

prepare failed: (1064) have error in sql syntax; check manual corresponds mysql server version right syntax use near 'index, sura, aya, text bn_bengali match(sura,text) against(?)' @ line 1 

where problem in script?

i want search database table match against.

but same script working fine

select sura, aya, text bn_bengali text ?

why not match against working? problem in script?

index reserved words in mysql must in backtick

your query be

select `index`, `sura`, `aya`, `text`... 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -