请问下PHP操作数据库的写法上的小疑点

WBOY
Release: 2016-06-13 12:49:54
Original
705 people have browsed it

请教下PHP操作数据库的写法上的小问题
问题在哪里呢?我只要在参数中给了$order值,就找不到记录
但是不给这个值 ,就能查到5条记录
我感觉是语法上有些问题,请记手指点一下,多谢了


------解决方案--------------------
order子句需要在limit子句前,而你的代码次序正好反了,所以导致语法错误。一般来说,limit是SQL语句中最后一个组成部分。
顺带提一下,你目前只是发现了查不到值,而这实际是SQL语句解析错误。如果你不知道怎么调试怎么发现问题,那么后面的路会很难走
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!