Home > Backend Development > PHP Tutorial > mysql 查询问题

mysql 查询问题

WBOY
Release: 2016-06-23 14:39:42
Original
696 people have browsed it

select * from commodity WHERE name LIKE $keywords ORDER BY rank $rank limit $pages, $rows


WHERE、ORDER、limit这三个同时用应该怎么排啊,上面这句不行 


这样就可以 select * from commodity ORDER BY rank $rank limit $pages, $rows


回复讨论(解决方案)

我知道了,进来拿一下分吧

select * from tbname order by id desc limit 0,10

好吧!那来接分了!

新问题 

"select * from subcatalog WHERE name LIKE '%$keywords%' and catalog = $catalog ORDER BY rank $rank limit $pages, $rows"


上面的语句,怎么可以做到当 $catalog 这个值为空的时候,可以搜索其他的数据,现在这里catalog = $catalog 为空的时候列表就没有东西出来了

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