how to use multiple ezr instances?
I'd like to display 2 or more sets of results, each from a different SQL statement. so far, I haven't had any problem with reusing the $ezr object after i've called $ezr-display:
$ezr->prep_sql($SQL_1);
$ezr->query_mysql($SQL_1);
$ezr->display();
$ezr->prep_sql($SQL_2);
$ezr->query_mysql($SQL_2);
$ezr->display();
My problem is that i'd like to register different functions for each SQL statement. when I do this:
$ezr->prep_sql($SQL_1);
$ezr->register_function('MyCoolFunction');
$ezr->query_mysql($SQL_1);
$ezr->display();
$ezr->prep_sql($SQL_2);
$ezr->register_function('MyOtherCoolFunction');
$ezr->query_mysql($SQL_2);
$ezr->display();
Then the second one (for $SQL_2) gets MyCoolFunction applied to it. Is there any way that I can UNregister the first function?
I've tried to wrap each one in a separate function like this:
WrapperFunc1();
WrapperFunc2();
function WrapperFunc1() {
global $ezr;
$ezr->prep_sql($SQL_1);
$ezr->register_function('MyCoolFunction');
$ezr->query_mysql($SQL_1);
$ezr->display();
function MyCoolFunction($c1, $c2, $c3){ // do something else };
}
function WrapperFunc2() {
global $ezr;
$ezr->prep_sql($SQL_2);
$ezr->register_function('MyOtherCoolFunction');
$ezr->query_mysql($SQL_2);
$ezr->display();
function MyOtherCoolFunction($c1, $c2){ // do something else };
}
This is the closest that I could get it to work - putting the global $ezr in there is the only way to get it recognized within the wrapper function, and I have to include the registered function within the wrapper function, or else it's just not called. But now I'm stuck - b/c even WITH putting it inside the wrapper function, I'm not getting the correct results.
I hope that I'm explaining this well enough.
