Skip to Main Content

One db call per page load. A good idea?

Ian6155178Aug 23 2011 — edited Aug 26 2011
Hi PHP experts! I’m new to PHP (but not Oracle) and I’d be interested in your comments on the following:

I have a HTML form that has a number of ‘List of Value’ fields that are displayed as <SELECT> tags.

I have a stored procedure that returns a ref cursor to a query that returns the list of values.

For each LoV field I call the stored procedure and loop through the results to build up my <OPTION> tags.

It’s simple and it works. So what?

This approach could involve many round trips to the database. I could make one call to a stored procedure to return all of the data I need in one go. I would pass the LoV IDs as an XML string to the procedure which would return all the LoV values back via another XML string. Both Oracle and PHP have strong XML support so this would be pretty easy but would it be a better approach?
Post Details
Added on Aug 23 2011