Click to See Complete Forum and Search --> : Prevent collisions?


Justin
06-21-2007, 02:26 PM
I am writing a script that will automatically be run once a day, and this script will intended to reset variables in a user table.

Is there a way or something I should do to prevent a user doing something that would allow the site from trying to edit the user table during this time...

Like is there a way i can somehow request exclusive access to the database and then wait for any pages that are still running talking to the database to finish (and putting any request during this time in a queue after the reset script), once they finished the reset script will go in and do its stuff and then when it is done the rest of the pending scripts would resume.

russell
06-22-2007, 09:37 AM
what dbms?

Justin
06-22-2007, 01:00 PM
This is done completely with php and mysql, no database management software if that was was you mean by dbms.

russell
06-22-2007, 01:17 PM
:) mysql is a DBMS

in general, starting an explicit transaction will prevent collisions. i dont work with mysql though (use mssql and db2), so hopefully someone better versed in mysql will wander by and show exact syntax for ya.