View Full Version : Re-check variable from postback every X seconds?

09-10-2010, 10:14 PM
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 :)


09-13-2010, 05:36 PM
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.