-2

Here is my code please help me...

$query = mysql_query("
   SELECT *
   FROM numeric1
   WHERE MATCH (s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26)
               AGAINST ('$f')
         AND id >='$id1'
         AND id<= '$id2'");
echo mysql_error();

I get this error:

Can't find FULLTEXT index matching the column list
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in

This result please help me to short out...

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
  • 1
    The error you're getting is because you have an error in your query meaning it's returning false instead of a resultset. I suggest using `echo mysql_error();` to get the actual error message from the database after you make your database call. – scragar Jul 23 '14 at 09:57
  • where is your Connection obj? – Ilesh Patel Jul 23 '14 at 09:57
  • @IleshPatel You don't need to specify it if you are using the last connection to be opened, in all likelihood he only has one connection. – scragar Jul 23 '14 at 09:58
  • 1
    echo mysql_error(); i think you didn't make fulltext index – Hossam Aldeen Ahmed Jul 23 '14 at 09:58
  • Please elaborate... i am not getting the right path.. – user3868162 Jul 23 '14 at 10:04
  • @user3868162 After your query put this line: `echo mysql_error();`, then let us know what error message it outputs. – scragar Jul 23 '14 at 10:36
  • @HossamAldeenAhmed You were right, he posted his error to a comment below: `Can't find FULLTEXT index matching the column list`. – scragar Jul 23 '14 at 11:41

1 Answers1

1

The error message which is displayed is because there is an error in your query which caused it to fail.

$query = mysql_query("
   SELECT *
   FROM numeric1
   WHERE MATCH (s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26)
               AGAINST ('$f')
         AND id >='$id1'
         AND id<= '$id2'");

if($query === FALSE) {
    die(mysql_error());
}

ie, you need to check $query before passing it to mysql_fetch_array. You'll find that it's false because the query failed.

And if you want to know what is the error then simple echo it like this:

if($query === FALSE) {
      echo mysql_error();
}
marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Rahul Tripathi
  • 161,154
  • 30
  • 262
  • 319
  • Please don't go writing the error from `mysql_error()` to the output in production code, always use an error handler to print it so you can ensure you don't go writing anything that could be useful to an attacker in the event of a bug. – scragar Jul 23 '14 at 10:09
  • Can't find FULLTEXT index matching the column list ... after putting if($querr === FALSE) { echo mysql_error(); } – user3868162 Jul 23 '14 at 10:42
  • After changing table into fulltext . Facing same kind of error. – user3868162 Jul 23 '14 at 11:39
  • Please help me as after changing complete table into fulltext getting same result... – user3868162 Jul 25 '14 at 08:06