Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    36
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re-check variable from postback every X seconds?

    OK, I have a content gateway that I'm trying to make it instant upon crediting of an offer.

    I need a way to store the user's session into a database, and and create a column named 'credit' and automatically fill it with '0'. Need a way to check the database every X seconds to see if a variable being posted to the site from another has a value of '1'

    There's some PHP involved yeah, but I was told that Ajax would be the way to constantly check every so often?

    If you can help, post here, or add my MSN; paul/@/blockis.com or AIM; Blockislandpaul

    Paul

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    You could do it with AJAX. Simply fire a request to the server every x seconds and return a bunch of JSON. However, this is a simple and effective way to reduce a perfectly happy production server to a pile of smoking metal: get a thousand users all firing their update requests every few seconds and you'll effectively DDOS yourself.

    Another solution - albeit a HTML5 one - might be to use a combination of Web Sockets and something like node.js. It's not simple, but it's scalable.


  •  

    Posting Permissions

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