What I would do is issue the create table statement and check for a return
code that say it already exists.  If it does, drop it then create it.  If it
doesn't exist, then it will be created and your application continues.

Don't bother writing a query to see if it exists and then perform an action
(drop/create or create).  That is an inefficient use of resources and a
waste of code.

-----Original Message-----
Date: Sunday, July 15, 2001 11:25 PM
Subject: [PHP-DB] How to drop a table when user leaves prematurely?


I'm sure this is fairly simple, but I have yet to come up with a way to do

In a nutshell, our application creates, uses and drops a table while the
user is working on the site. Unfortunately, because of "other
considerations", we can't use a defined temp table - it has to be created as
a regular table. We have a routine in the app that will drop the table once
the user is done with their work, but if they leave for some reason before
they're done, the table is left hanging out there. This wasn't a problem at
first, but we're building up quite a collection of useless tables right now.

Is there any way to drop the table automagically when the user leaves
prematurely, either by closing their browser or jumping to another site? I
tried using register_shutdown_function(), but it didn't seem to have any

I think, and I know I may be way off base, is that there are a lot of pages
involved in this application, and I'm not sure how to tell the app that the
user is just going from one page to the next or is actually going bye-bye...


The Entertainment Center
Home Of Radio Free BD
For A Difference.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to