KYKK Posted June 9, 2008 Share Posted June 9, 2008 Hi, i am making a brower game. and i want a count up thing like add # per hour .... and the # can change so i need a field for that # right .. then i don't want it to change like pop # every hr i want it to increase a little per min,,,,get what i mean ? thanks Link to comment Share on other sites More sharing options...
Ingolme Posted June 9, 2008 Share Posted June 9, 2008 Hmm... well, I don't get the whole concept, but I think that you're trying to do is increase a counter with the time spent on the page.If that's what you're trying to do, you can use AJAX to send a request to a PHP file every minute using the setInterval() or setTimeout functions.The PHP file can add 1 to a field in the database and it will store the minutes played. After that you can divide that by 60 to count the hours when you extract it from the database. Link to comment Share on other sites More sharing options...
KYKK Posted June 9, 2008 Author Share Posted June 9, 2008 o so you mean i need to set how many per min and then make it to show how many her hour....let me read throught AJAX w3school first....._______________________________here what i understandfirst need some code to say .... alert ("Your browser does not support AJAX!"); (y can't they have only 1 brower in the world...)_______________________________and is it have anything to do with MySQL Database ? i don't see anything about connecting to mysql so how is it going to work for login and ..... ? Link to comment Share on other sites More sharing options...
vytas Posted June 9, 2008 Share Posted June 9, 2008 Wy is there Ajax involved increase the # serverside but show the users client side that the counter is moving up, if u use AJAX to send the # to the server alot of wacko's will just modify some data and they will have a unfair # , my advice is let the # increase every half an hour or so but show client side how the counter is doing. Link to comment Share on other sites More sharing options...
KYKK Posted June 9, 2008 Author Share Posted June 9, 2008 my advice is let the # increase every half an hour can i do it for few sec, bcause those cool browers games do that... Link to comment Share on other sites More sharing options...
Ingolme Posted June 9, 2008 Share Posted June 9, 2008 Most "browser games" are actually done in flash, or sometimes Java.The whole game is played on client-side and when the player saves, the data is sent to the server, or the data is sent to the server on a certain interval of time. Link to comment Share on other sites More sharing options...
KYKK Posted June 10, 2008 Author Share Posted June 10, 2008 Edited: I read the ajax in w3schools and i did the like form thing...and my host provider don't provide .asp . .. . . so going to make the register thing first.....________________________________________________________________________Edited: but to make my game, do i need to like send +1 +1 +1 like that to Mysql database??_________________________________________________________________________http://travian.us/http://the-mafia.the-mafia.dehttp://spaceinvasion.bigpoint.com i think it code because when i use firebug it show codes...like function ... and function ... a whole list...long list..ok so here what i learn todayyou put ajax codes in <script type="text/javascript">and there a code that see if it work on exploroers ...firefox..opera..sfari...and xmlHttp.open("GET","time.asp",true); is mean open time.asp.... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.