This is difficult to answer, as you are actually the best person to 
decide. Consider some of the following things:

1. How often do you anticipate people will use the "printer-friendly" link?
2. How much data do you anticipate, on average, to be contained in the 
results of these queries?
3. How much traffic do you anticipate?
4. How much memory does your Web server have?
5. Are you maintaining sessions anyway, or would this be the only thing 
to require them?

My (uneducated) guess would be that querying again is the best approach. 
You're basically talking about a separate request anyway, and the 
overhead of maintaining state might not be worth it, as you may end up 
with many of these result sets stored in the session, and the client may 
never use them.

Happy hacking.


Ashley M. Kirchner wrote:

>I'm working on converting several static (price) pages on our site into dynamic 
>pages, with the data stored in an MySQL database and PHP to pull the data out, with 
>CSS to build the page and present it.  At the same time, I would also like to have a 
>'printer friendly' link on each page that visitors can click on and get the same page 
>re-rendered for easy printing.  What's the best way to get the data converted from 
>one form to another?  Should I be querying the database again to get the same data to 
>reformat?  Should I store the data in sessions and reformat based on the CSS?  I 
>would think having to query twice for the same thing would be a degradation in 
>performance, right?  So what's the best practice?

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to