|
Posted by ELINTPimp on 08/30/07 17:13
On Aug 30, 12:56 pm, "phil...@gmail.com" <phil...@gmail.com> wrote:
> Hello everybody,
>
> I have a page rech.php where I'm doing a multi-criteria research Ex.
> choose your car model, choose your country.
> After validation of my form, on the same page, the lines will be
> displayed (I put a max limitation of 500 lines). Ex. list of cars Fiat
> to buy in UK.
>
> A clic on a line will bring me to the display page disp.php Ex. I will
> clic on the car n° 5 => <a href="disp.php?
> line=5&country=uk&model=Fiat">car n°5</A>.
> As you can see disp.php will receive in parameters all the
> informations of my query (country=, model=) and I will re-execute the
> big multi-criteria query in disp.php for each page!
> But if the webmaster will delete the record n°4, I'm bloqued. I'm in
> disp.php on the record n°5 and if I clic on the previous button, the
> script will look for the record n°4 which doesn't existe anymore.
>
so the problem is when/if the webmaster deletes a record between the
time the user initially requests the listing and when he finally
clicks on that record (or previous, in your example)?
> Here is my big question : Is there a solution to do only once the big
> multi-criteria request and save it in a temporary table (but then when
> do I need to delete the temp table) or an other solution to do things
> better ?
Yes...but first are you sure you want to do this? If the webmaster,
or whoever, deletes a record in the database, I'm sure there was a
reason for it...the data isn't valid anymore and the user shouldn't
see this ghost data.
Depending on your database, you can create a persistent session,
create a temp table within the database with the data you want to
preserve, and when the session is closed the temp table dies. Now,
persistent DB sessions have their own set of problems, in addition to
the data "ghosting" I talked about as well as the user getting old
data. For example, what if the user searches and your webmaster ADDS
data to the database? That data won't be available until they kill
their session and create another?
A temp table might not be best solution for temporarily saving your
data either, but that's what you asked for. Depending on your data
size, it might be best for a namespace within the $_SESSION
superglobal...
Still, I highly suggest you consider all the effect this would have on
your application. Yes, there are some downsides to typical web
application development (in this case, a new request per page
refresh), but that also opens doors to others.
Steve
[Back to original message]
|