SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Do not display normal pages when the update script is executing

    Hi all,

    I have a script that runs hourly (to update players' resources) and would like to stop any other transactions when this script is running.

    For example, at 1200hrs, when the script runs, any other pages will display "Resources updating" until the script ends (which takes 20 seconds average).

    I am thinking of the following method:

    1) At the beginning of the hourly script, set a field in the database to '1'.

    2) All other scripts will check this field before any output, If its a '1', then says "Resources updating" else, do as usual.

    3) The field will be set back to '0' upon finishing of the hourly script.

    Do you think this is viable? Or is there any other better methods?
    I am using Mysql as the database.

    Any comment / advise is appreciated.
    Thank you.

  2. #2
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Anyone wants to share your views?
    Feel free to comment

  3. #3
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would probably do it that way, unless I found a better way.
    John

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah sounds like it would work fine.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •