I'm building my personal Database connection model and one thing that I needed to do is allow the user to start a loop using a function and end the loop in another function. This is the code:
Code for running the functions
PSMQuery::loopQueryStart("DATA");
// Stuff that can be executed in the loop
PSMQuery::loopQueryStop();
Code in the class:
public function loopQueryStart($query) {
while (CONDITION):
}
public function loopQueryEnd() {
endwhile;
}
And I was wondering if this method should work and if there would be another way, just to simplify the look of the code for someone using my model.
PSMQuery::loop("Data", function($var) { /* sth */})?CONDITIONfalse, thus ending the while loop?