I got 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 'and idcat = 00 OR idcat = 11 OR idcat = 4 OR idcat = 8 OR idcat
>  = 10 OR idcat ' at line 6
> 
> 
> 

I tried to do this query on PHP

```
SELECT *,
        MATCH (name,description) AGAINST ('key') AS relevancia
  FROM offer
  WHERE
      MATCH (name,description)
          and idcat = 00
          OR idcat = 11
          OR idcat = 4
          OR idcat = 8
          OR idcat = 10
          OR idcat = 5
          OR idcat = 7
          OR idcat = 1
          OR idcat = 2
          OR idcat = 3
          OR idcat = 6
          OR idcat = 9
      AGAINST ('key')
  ORDER BY discount DESC
  LIMIT 0, 15

```

But if I try to do this query directly on phpmyadmin it works fine. So I don't know why does not work on PHP if it's same consultation .

By the way excuse my poor English.

**EDIT:**

This is the php consulation

```
$sql2 = "SELECT *, 
MATCH (name,description) 
AGAINST ('$search')
AS relevancia 
FROM offer 
WHERE MATCH (name,description) AGAINST ('$search')  
and  $wheres $order $limit";

echo $sql2;
mysql_query("".$sql2."")  or die (mysql_error());

```

The php result on $sql2

```
SELECT *, MATCH (name,description) AGAINST ('key') AS relevancia 
FROM offer 
WHERE MATCH (name,description) AGAINST ('key') 
and idcat IN(00, 11, 4, 8, 10, 5, 7, 1, 2, 3, 6, 9) 
ORDER BY discount DESC LIMIT 0, 3

```

Error in php-mysql

```
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
'idcat IN(00, 11, 4, 8, 10, 5, 7, 1, 2, 3, 6, 9) ORDER BY discount DESC' at line 5

```