|
Posted by Toby Inkster on 01/03/07 17:53
craig.keightley wrote:
> value 1
> value 1
> value 1
> SHOW ROW
> value 2
> value 2
> SHOW ROW
> value 3
> value 3
> SHOW ROW
> value 4
> value 4
> SHOW ROW
Thinking laterally, is "SELECT DISTINCT" an option?
If not, the basic technique is this:
<?php
$oldvals = array();
while ($newvals = fetch_row_from_db())
{
if ($newvals is different from $oldvals)
{
print $oldvals;
}
$oldvals = $newvals;
}
print $oldvals;
?>
You will need to adapt that to your situation.
This way, rather than trying to "look ahead" to the next row in the data
set, you're actually "printing behind" the previous row. Same effect, but
much easier to implement, because the next row is always a mystery,
whereas the previous row is already known.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|