PHP 不回显最后一行的文本
我正在尝试在 php 中编写一个相对简单的 twitter 查询,结果如下:
from:TravisBenjamin3 OR from:AshleyElisaG OR from:tncvaan ...
这段代码可以工作,接受它不会回显第二个 OR,我也不这样做想要在最后一行显示 OR。
$counter = 0;
while($row = mysql_fetch_array($result)){
$counter++;
echo " from:";
echo $row['twitter'];
if ($counter < count($row)) {
echo " OR";
}
}
一些帮助将不胜感激。谢谢,
I'm trying to write a relatively simple twitter query in php with result like this:
from:TravisBenjamin3 OR from:AshleyElisaG OR from:tncvaan ...
This code works accept it doesn't echo the second OR, also I don't want to display an OR on the last row.
$counter = 0;
while($row = mysql_fetch_array($result)){
$counter++;
echo " from:";
echo $row['twitter'];
if ($counter < count($row)) {
echo " OR";
}
}
Some help would be greatly appreciated. Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
或者,更简单:
这实际上是 Aaron W. 建议的 implode() 的穷人实现。
Or, even easier:
Which is actually a poor man's implementation for implode() suggested by Aaron W..