Re: Problems with FOR loop
Posted: Sat Feb 16, 2013 11:05 am
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!
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
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.