ILYAS415 Posted August 8, 2008 Share Posted August 8, 2008 Hi. Im making a game and im tyring to update a players health automatically every 10 seconds. Heres what I have come up with... <script language="javascript" type="text/javascript"> <!-- function updateHealth(){ changeText("health", "<b>H</b>ealth: [<?= $fetch->health ?>/<?= $fetch->maxhealth ?>]"); } setInterval("updateHealth()", 10000); //every 10 seconds //--> </script> The above code works fine. However if i were to change the players health on the db, it wouldnt change on the page every 10 seconds. It would get the original rows from when the page originally loaded. Help please? Thanks Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 8, 2008 Share Posted August 8, 2008 1) Don't use short tags. 2) Look into Ajax. Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted August 8, 2008 Author Share Posted August 8, 2008 Lol sorry i missed out the fact that i didnt want to use Ajax. Its too much to go just to edit something so small. Btw i already no how to use ajax Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.