MySQL: SELECT DISTINCT skipping the first row?
by The Cow Exchange
Troubleshooting PHP/MySQL issues, gospel-style.
http://answers.yahoo.com/question/index?qid=20090207194414AAcmTwd
Sometimes the Singing Answerman just has to be helpful.
** - UPDATE: This song was chosen as the "Best Answer" to the question. And the suggestion "worked perfectly." See? I'm not always full of crapulence!
You call a fetch_row and store the result in $numrows2, but calling num_rows is what you meant to do. So your first row is skipped in the subsequent loop. I bet if you comment out line 13 and run it again you'll see what I mean, and your output will appear complete.
Yeah that "while" loop's just gonna continue where the cursor's at. Don't throw in your hat! It's all gonna show how you ask it to be! While we're at it, don't forget to thwart HTML injection attacks by calling htmlentities where applicable!