FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Query or Array functions
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Query or Array functions [message #176957 is a reply to message #176956] Fri, 10 February 2012 01:39 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Scott Johnson)

> First off I am doing this on a back-end admin page.
> I have a DB with lets say 5000 records and a dozen or more fields.
>
> On the page which will display these records I am planning on using
> pagination to display so many records at once. So far so good.
>
> What i would like to do is provide a row above the table of records
> where the user can enter text to filter the display on each column.
>
> I plan to use AJAX and filter as the user types which in itself is not a
> problem.

Why AJAX? Why not do it the simple way with a "refresh" button?

> The problem I see is the numerous DB queries and I don't see querying
> the DB each time the user types a letter as a practical approach. (I
> could be wrong).
>
> What I was thinking of doing is loading the full record set into an
> array and then filter out the array of the needed data as the user types.
>
> I have not done any intense array manipulations like this before and am
> wondering if this seems like a practical approach.

I don't think so. You still have to fetch the data from the DB whenever
the user changes the filter. Every AJAX request to the server is just
another HTTP request, completely independent from all others before.

You can't store big data from one request and then just output parts of
it on every coming request (unless you store all the data in a session,
but this wouldn't make much sense here and would still cause a lot of IO
overhead).

In other words: Every request (including the ones via AJAX) causes your
script to start from scratch again, so you have to fetch the data and
filter it over and over again anyway. Also don't forget that after the
user changes the filter options, the new data has to be transferred to
the client. When there's a lot of records, this might take some time.

Don't expect a real-time display and ask yourself: Do you really need
AJAX stuff or wouldn't it be enough to use a good old-fashioned form
with a "refresh" button?

Micha

--
http://mfesser.de/blickwinkel
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 6 line php 2 asp
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 02:43:29 GMT 2024

Total time taken to generate the page: 0.03300 seconds