re-using arrays
| From: | olinux | Date: | Sat, 24 Mar 2001 17:34:00 +0000 |
| Subject: | re-using arrays | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7755@lists.php.net to get a copy of this message | ||
I would like to have my table of results sortable by various fields. Similar to www.mysimon.com
Would it be faster for me to re-use an array rather than connecting to the DB again, select the same
info, and send it again?
If so how would you go about this?
I would think that you could store the array in a session when you originally select it. But then it
seems to me that if people do not re-sort items as often as you think then you would end up wasting
bandwidth and pissing people off (slowing page load time) by resending the array each page.
something like this:
session_start();
session_register('last_search');
$last_search = $result_of_query
Any thoughts? I was just thinking that once the client has the results on his/her machine, then
there should be no need to reconnect to the DB (unless the search is different)
Thanks much,
olinux