Re: how to lock a block of php codes




Hi Kelvin,

I generally use a text file as a lock so:

$fp = @fopen("lock.txt", "w+"); //open lock file
if ($fp && (flock($fp, LOCK_EX))) {//place an exclusive lock on the file
//do stuff
@fclose($fp); //release Lock

cheers
ED

In all honesty in this instance it maybe better to keep a log of the
transaction id's (paypal creates a unique transaction ID for each 1). Simply
store this id in a database of some kind and if it already exists do not
process it again.


.



Relevant Pages

  • Re: SQL Code Problem
    ... Go to the directory you store the ... database and find the file.LDB. ... Then when ran it it responding with and error ... > 3211 cannot lock table because its in use by another person or process. ...
    (microsoft.public.access.queries)
  • Re: Parameterization of Object Models
    ... Lock down Access to the system -- ... Attempt to prevent deadlocks see The Concepts of Database Management, ... recovery; that is, you say that you recovered the database. ... database (called a backup or a save). ...
    (comp.lang.misc)
  • Re: Limit FORM mailer submissions to 5 on website, then pause until reviewed by webmaster
    ... have a script that creates a temporary row in a sessions table as soon ... then don't display the input form and instead display the message, ... You wouldn't lock the file from the time they come to the page until ... the database occurs, ...
    (comp.lang.perl.misc)
  • Re: Running Analysis Server 2000 on seperate box
    ... On further investigation regarding the lock up problem. ... the dimension processing running and although the database rows are ... changing the service account sorted things. ... The server has both the database and Analysis Services ...
    (microsoft.public.sqlserver.olap)
  • Re: Command Line for Backing up Source Safe.
    ... If anybody else know of a command line way to lock the database let me know. ... Archive to a backup. ... > @echo off ...
    (microsoft.public.vstudio.sourcesafe)