如何在 PHP/MYSQL 中限制条件结果查询?
我需要限制带有条件 WHERE 的查询的前六个结果。
我想做这样的事情:
mysql_query("CREATE VIEW [test] AS SELECT * FROM table WHERE status=1");
$sel = "SELECT * FROM [test] LIMIT 0,6";
$result = mysql_query($sel);
while($r=mysql_fetch_array($result)){
echo "".$r['id']."<br>";
}
我该怎么做?谢谢!
I need to limit the first six results from a query with a condition WHERE.
I would like to do something like that:
mysql_query("CREATE VIEW [test] AS SELECT * FROM table WHERE status=1");
$sel = "SELECT * FROM [test] LIMIT 0,6";
$result = mysql_query($sel);
while($r=mysql_fetch_array($result)){
echo "".$r['id']."<br>";
}
How can I do it? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要限制您订购的条件选择。 (您可能不必订购这个)
You need to limit your ordered conditional selection. (You probably don't have to order this)