C.R.Vegelin wrote: > ----- Original Message ----- From: "Jochem Maas" <jochem@xxxxxxxxxxxxx> > To: "C.R.Vegelin" <cr.vegelin@xxxxxxxxx> > Cc: "David Giragosian" <dgiragosian@xxxxxxxxx>; "php-general" > <php-general@xxxxxxxxxxxxx> > Sent: Friday, November 02, 2007 10:41 AM > Subject: Re: Transfer query result to another script > > >> C.R.Vegelin wrote: >> >> ... >> >>> >>> Hi Jochem, >>> >>> The reason for a redirect is that Report.php has functionality such as >>> sorting on report columns, checkboxes to make graphs etc. >>> >>> Suppose the following report columns: >>> Country 06.Q1 06.Q2 06.Q3 06.Q4 07.Q1 07.Q2 >>> 1 Austria 1226 1211 1233 1328 1386 1362 >>> 2 Belgium 1004 1193 1008 9737 1102 1270 >>> 3 etc. >>> >>> If I don't use a redirect but an include Report.php then Engine.php must >>> be rerun: >>> - every time a user wants to sort on a columns, eg. Y06.Q1 >>> - every time a user wants to make a graph with selected rows. >>> >>> Right ? I did use an include but I'm changing it because of the reasons >>> above. >> >> using a redirect doesn't solve the 'problem' - what does Engine.php doe >> exactly? how long does it take? your going to have think about caching >> the >> dataset generated by Engine in some way ... and sticking a MySQL >> resultset >> resource id in $_SESSION is not going to work. >> >> also does calling the script 'Report.php' mean you no longer have >> to refresh the page if you want to use different parameters? or do you >> still >> have to do a page refresh?? >> >>> I know it does have its price. >>> >>> Regards, Cor >>> > > Hi Jochem, > > Engine.php does the following: > a. checking validity of form query fields > b. sending messages if invalid form query fields > c. building the sql and executing it this is the only critical step. > d. new: building $_SESSION['data'] for Report.php > e. include / redirect for different output formats d & e are going to win you nothing (apart from a headache). (i.e. how are you going to store a million record resultset in $_SESSION) > > Step d. now passes the result set to Report.php. > So Engine.php now redirects to Report.php once per query, > and when the user changes report settings, Report.php is called by > itself with required settings. > More or less comparable to > http://www.tonymarston.net/sample/person_list.php, > except that my application is read-only and provided with graphs. the other difference is that Tony Marston is really rather good at this kind of thing - and I'm willing to bet his apps never store dataset (in the way you describe) in $_SESSION. > > I have to admit that I haven't tested the time needed for steps a-c. > So I may save some time at the cost of extra mem to pass SESSION['data']. > On the other hand, by splitting Engine and Report code I may save some > mem, I think. no your not saving mem, AFAICT. your creating a round http request that adds to the time taken, your also writing and reading large ammounts of data to and from php's session file ... not exactly fast. I bet that even without any attempt at performance optimization that just performing the query and then letting the correct output handler loop the result resource (i.e. no storage of dataset, no redirects) that it will run faster than anything you attempt using this crazy 'stuff-big-sets-of-data-in-the-session-and-redirect' strategy. > > Thanks for your time, Jochem. > Regards, Cor > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php