Mysql_query错误

I have one problem with this mysql_query:

$selectNewsComments = mysql_query("
SELECT user_id, comment, time_add 
FROM news_comments 
ORDER BY id DESC 
LIMIT " .($pageNum - 1) * $numberOfNewsInPage . ", ".$numberOfNewsInPage." 
WHERE news_id = '".$nid."'
") or die(mysql_error());

That is error message:

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 'WHERE news_id = '18'' at line 1

Can someone tell me from whear come this proble?

Your ORDER BY id DESC LIMIT should go after the WHERE

Warning: The question's sample code uses PHP's mysql extension, which was deprecated in PHP 5.5.0 and removed entirely in PHP 7.0.0.

The WHERE clause should go before ORDER BY.

mysql_query("SELECT user_id, comment, time_add FROM news_comments WHERE news_id = '".$nid."'ORDER BY id DESC LIMIT " .($pageNum - 1) * $numberOfNewsInPage . ", ".$numberOfNewsInPage)

use this instead

$selectNewsComments = mysql_query("
SELECT user_id, comment, time_add 
FROM news_comments 
LIMIT " .($pageNum - 1) * $numberOfNewsInPage . ", ".$numberOfNewsInPage." 
WHERE news_id = '".$nid."'
ORDER BY id DESC 
") or die(mysql_error());

what i changed is :
i placed ORDER BY id DESC in the end of the query where is should be so that it works