For whatever reason, I need to go through a MySQL result set twice. Is there a way to do it?
I don’t want to run the query twice and I don’t want to have to rewrite the script so that it stores the rows somewhere and then reuses them later.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is how you can do it:
However, I would have to say, this doesn’t seem the right way to handle this. Why not do the processing within the first loop?