[FX.php List] Re: if andy's code doesn't work...
Roger Price
rp272 at cam.ac.uk
Tue Jan 16 08:41:20 MST 2007
Andy & Alex
Thank you both for your input on this.
I recognised that there was a problem with the counter 'start' value when the formatting did not work and added the variables to a page to see what was happening. This was not the whole issue though as I had also set a $returnLimit which was lower than the 'Found Count' so the condition for the 'last item' format never occurred. A bit of 'conditional' logic, sorted things out and my final entry displays as I wanted.
kindest regards
Roger
----- Original Message -----
From: "Alex Gates" <alex at gandrpublishing.com>
To: "'Roger Price'" <rp272 at cam.ac.uk>
Sent: Monday, January 15, 2007 8:46 PM
Subject: if andy's code doesn't work...
> Hi Roger-
> If Andy's code doesn't work, try making $i=1 instead of $i=0.
>
> I don't think Andy's solution will work to show your last record
> differently.... that's because he doesn't add the counter until after it
> is written.... so $i wont reach your found count because it will be done
> looping before it equals your found count.
>
> Give it a shot if Andy's solution doesn't work... or let me know if you
> need any more help!
>
>
> Alex P. Gates
> G&R Publishing Co.
> 507 Industrial Street
> Waverly, IA 50677
> Ph: 319-352-5391 x 319
>
----- Original Message -----
From: Andy Gaunt
To: 'FX.php Discussion List'
Sent: Monday, January 15, 2007 2:47 PM
Subject: RE: [FX.php List] Conditional formatting of last item
Roger,
What you may need to do is use a counter and if the counter equals the found count then apply your new style.
Something like
$counter = 0;
$foundCount = $queryResult['foundCount'];
foreach($queryResult['data'] as $key = $value) {
if ($counter == $foundCount) {
//Change your style here
} else {
// Perform standard style here
}
// Rest of your query can go here
$counter++;
}
HTH
Andy Gaunt
Office: 321.206.3658
Mobile: 407.810.4722
andy at fmpug.com
http://www.fmpug.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070116/774f0891/attachment.html
More information about the FX.php_List
mailing list