Problems with FOR loop
Moderator: General Moderators
Re: Problems with FOR loop
I should point out I ran your code exactly as you wrote it and the prefix for each name was 17!! That's the reason I've tried moving that section of the code slightly!
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Problems with FOR loop
Add " ORDER BY yearofbirth" to the end of the SQL.kdidymus wrote:1) How would I sort the results by YEAR OF BIRTH? This is something I've been thinking about for a while but now that the results are in an array it SHOULD be easily done. I've researched usort, asort etc. but can't seem to get it to apply to my code!
Move $p=1 to outside, before the while loop. Obviously it was setting the value back to 1 each loop.kdidymus wrote:2) How do I ensure the prefix is an incremental number? At the moment every entry is shown as 01!! I think this is because the results are fetched as an array and "dumped" all at once.
(#10850)
Re: Problems with FOR loop
Thanks. Works like a charm. Using your loop code for spouses and siblings is throwing up a RESOURCE / BOOLEAN error but I think that's because of a lack of error trapping.
I'm well on my way!
Thank you again.
I'm well on my way!
Thank you again.