Mysql查询错误限制

I write a website and use php. When ı write

$cat = mysql_query("
Select m.Image_link AS link
     , m.Name
     , m.ID
     , c.Name AS catName
  from movie m
  join has_category mc
    on m.ID = mc.movie_id 
  join category c
    on c.ID = mc.category_id
 where c.Name = '$category'
 ORDER 
    BY ID desc"
);

this query everything is okay but when ı insert limit, ı take error.

@$sayfa=$_GET['s'];

$kacar=12;
$toplansayfa=ceil(mysql_num_rows($cat)/$kacar);
$baslangic=($sayfa * $kacar) - $kacar;


$bul_cat=mysql_query("
Select m.Image_link AS link
     , m.Name
     , m.ID
     , c.Name AS catName 
  from movie m 
  join has_category Mc
    on m.ID = mc.movie_id 
  join category c
    on c.ID = mc.category_id
 where c.Name = '$category' 
ORDER 
    BY ID desc 
 limit $baslangic, $kacar
");


echo mysql_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 '-12, 12' at line 1

Where is my mistake..thanks for your interest.

As with many SQL programming errors, it helps a great deal to look at the actual text of the query you tried to run.

So, try this:

$query = "Select movie.Image_link AS link, movie.Name, movie.ID, category.Name AS catName from (movie inner join has_category on movie.ID=has_category.movie_id inner join category on category.ID=has_category.category_id) where category.Name='$category' ORDER BY ID desc limit $baslangic, $kacar";

$bul_cat = mysql_query($query);   /*deprecated API! */
if (!$bul_cat) {
      echo "query failed: " . $query;
      echo mysql_error();   /* deprecated API! */
}

You will almost certainly spot the problem right away when you display the actual query you tried to run. I'm sure Paul Siegel's diagnosis is correct... your query says LIMIT -12,12. You Can't Do That™.