times

Discussion in 'PHP' started by shotazi, Mar 14, 2008.

  1. #1
    so, i want to do something like this:
    when you open php file, after 20 second file insert some information in database.

    how i can to do this? :confused:

    thank you
     
    shotazi, Mar 14, 2008 IP
  2. mulari

    mulari Peon

    Messages:
    45
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm assuming you mean after the page was already sent to the user.

    If i'm right, then PHP is not the answer. You need some AJAX (javascript) code to run on the client (user) side and will be executed after 20 seconds (easily done with javascript timeout). After the 20 second the function will make a request to another script (AJAX) that will insert the data you want to the db.

    Try to look around about AJAX and i'm sure you'll find your answer there.
     
    mulari, Mar 14, 2008 IP
  3. Tyler

    Tyler Peon

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you give us more information on what you are trying to achieve? As mulari, stated, PHP may not be the answer for it. But, under some circumstances (such as a cron), it can be done, depending on what you are trying to do.
     
    Tyler, Mar 14, 2008 IP