plugins - SQL query, error

I have sql query:$query= "SELECT * FROM files ORDER BY id DESC LIMIT $from, $site WHERE custom > 0";but not

I have sql query:

$query= "SELECT * FROM files ORDER BY id DESC LIMIT $from, $site WHERE custom > 0";

but not work, i have notice:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax

What i do wrong?

I have sql query:

$query= "SELECT * FROM files ORDER BY id DESC LIMIT $from, $site WHERE custom > 0";

but not work, i have notice:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax

What i do wrong?

Share Improve this question edited Jul 21, 2019 at 23:31 Jaron asked Apr 6, 2019 at 21:01 JaronJaron 458 bronze badges 1
  • Order by has to be after where. – Howard E Commented Apr 6, 2019 at 21:16
Add a comment  | 

1 Answer 1

Reset to default 2

You have the where clause of the query in the wrong place.

Your query should be written like this:

$query= "SELECT * FROM files WHERE custom > 0 ORDER BY id DESC LIMIT $from, $site";

As specified here https://dev.mysql/doc/refman/8.0/en/select.html in the MySQL reference.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745307192a4621781.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信