如何在每10行SQL查询后显示文本? [英] How can i display text after every 10 rows of an SQL query?
本文介绍了如何在每10行SQL查询后显示文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
说我有一个查询从用户中选择用户名".我想将此查询输出到PHP页面上,但是每10行之后我要显示自己的自定义文本.有任何想法吗?它将从第11个记录继续.
Say i have a query "select username from users". I want to output this query onto a PHP page but after every 10th row i want to display my own custom text. Any ideas? and it will continue from the 11th record.
推荐答案
$count = 0;
while (false !== ($row = mysql_fetch_array($result))) {
//output your row
++$count;
if (($count % 10) == 0) {
//output your special row
}
}
这篇关于如何在每10行SQL查询后显示文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文