I ran into a similar problem troubleshooting a modification to a plugin. I used a foreach after a query to output some variables in the query results. Subsequent plugin code used a while (!$results->EOF) loop to process the query results again, but consistently fails. I discovered that !$results->EOF was false at the while loop even though there were results from the preceding foreach loop. I tried LAT9's approach but at least EOF is not restored. Removing my troubleshooting foreach loop eliminated the problem and the while loop executed normally.
I would like to understand and avoid this problem in future troubleshooting activities. Any other suggestions on how to reset the query results including EOF?
TIA. Dave
zc157c, PHP 8.0.22, mysql 5.7.39


Reply With Quote

