You are here: Re: how to identify the last row in a while loop « All PHP « IT news, forums, messages
Re: how to identify the last row in a while loop

Posted by Steve on 11/10/06 15:28

"davek" <news@smutchin.co.uk> wrote in message
news:1163171727.790425.217860@i42g2000cwa.googlegroups.com...
| Here's a simplified outline of what I want to achieve:
|
| $this = output of some mysql SELECT query;
| $rownum = 1;
|
| while ($this) {
|
| echo $this;
|
| if ($rownum % 15 == 0 AND [!LastRow]) {
| echo $that
| }
|
| $rownum++
| }
|
| It's the "[!LastRow]" that I am stuck on. Any thoughts?

what function are you using to do the db calls? most all of them have a
method to get the number of rows returned from a query.

$this = output of blah, blah, blah
$record = 1;
$lastRecord = mysql_num_rows($this);
while ($this)
{
echo $this;
if ($record % 15 == 0 && record != $lastRecord){ echo $that; }
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация