NYCPHP Meetup

NYPHP.org

Query to Array and Array loop performance hit.

Mark Armendariz nyphp at enobrev.com
Sun May 25 10:05:10 EDT 2003


Good Morning and Happy Sunday New Yorkers (and good day to everyone
else)...
 
I'm currently working on a project with a designer, and I'm trying to do
my very best to keep my code as clean and out of his way as possible.
So basically I'm putting all my queries and all the good creamy filling
up on top, and then keeping all php code to a minimum on the bottom,
when he can rock the design.  I try to to this as much as possible as
is, but I always worry about performance (primary wrory based on this
question).
 
Clean code, check.  Queries and logic up top, check.  Output
formatting... gets a bit sticky.  The primary issue I have is
formatting.  For instance, to keep the code clean down below, I format
columns for the designer.  For instance, I format all date fields for
him, concat all vars for him (I know I can use mysql concat, but that
doesn't solve all var issues), and whatever other logic might be
necessary.  Since this is part of a outputted query loop, I can't quite
put all that logic up top.
 
So, to me, the obvious answer would be to loop through the returned
array (from the query) up top, format all the columns into a separate
array and then in the actaul doc, run a nice and neat foreach to loop
through the formatted array.  So my questions are:
 
How badly would that hurt page response time?
 
Is that just too much work for each page load?
 
Is there another viable solution (outside of templates - i've used them
and I tend to avoid them)?
 
Thanks, and have a great Sunday!!!
 
Mark Armendariz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030525/36cd6729/attachment.html>


More information about the talk mailing list