[FX.php List] Re: if andy's code doesn't work...
Andy Gaunt
andy at fmpug.com
Tue Jan 16 08:50:24 MST 2007
Alex,
Good catch on the counter.
I am so automated to start a counter at 0 that I did not think before
posting. You could leave the counter at 0 and just move the $counter++; to
above the if statement. This way the counter is incremented before the
check.
Roger, glad you got it solved.
Andy Gaunt
Office: 321.206.3658
Mobile: 407.810.4722
andy at fmpug.com
http://www.fmpug.com
2006 FileMaker Excellence Award Winner
Recipient of FileMaker's 2005 "Mad Dog" Public Relations Award
For chapter locations, dates & times please visit the website at
http://www.fmpug.com If you can make it to a meeting, please RSVP at
http://www.fmpug.com/rsvp.php
_____
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Roger Price
Sent: Tuesday, January 16, 2007 10:41 AM
To: FX.php Discussion List
Subject: [FX.php List] Re: if andy's code doesn't work...
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" < <mailto:alex at gandrpublishing.com>
alex at gandrpublishing.com>
To: "'Roger Price'" < <mailto:rp272 at cam.ac.uk> 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: <mailto:andy at fmpug.com> Andy Gaunt
To: <mailto:fx.php_list at mail.iviking.org> '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/791117f0/attachment-0001.html
More information about the FX.php_List
mailing list