Page 2 of 2

Re: Problem whit retrieving data from MySQL

Posted: Thu Mar 18, 2010 4:52 am
by Grizzzzzzzzzz
all you need to do is write your script that you want to run every minute/hour/second to increment people's resources, and slap a meta-refresh tag on the end of it

so it'll look like this

Code: Select all

 
 
<?php
 
//MYSQL update statement here to give resources to all your players
//Include all the maths of iron mine levels etc...
 
?>
 
<!-- Add this bit of HTML on the end of your script -->
<meta http-equiv="refresh" content="60">
 
 

Then, when you want the 'server' to have the game active, load up that script in a browser somewhere, and leave it to run.

Like i said, it's totally barbaric in theory but i imagine it's one of your only options

or you could give this a read

http://dev.mysql.com/tech-resources/art ... nts.html#1

Re: Problem whit retrieving data from MySQL

Posted: Thu Mar 18, 2010 11:56 am
by Worqy
Okey, thank you alot.
Just one question more.
How could I make the updating of resources in main.php good, because if I use META to direct me to checklogin.php and back, its very very disturbing for the user. Same thing if I move the MySQL retrieve system to main.php and use META to refresh the page every second.
Very disturbing for the user!

When I looked for example at Travian ( http://www.travian.com ), the resources comes without the page refreshing or anything like that.

EDIT:
Is the easies way to retrieve the data from MySQL in the script, then add something to it, put it in a Session and then show the Session in main.php, insted of retrieving the data, add something to it, upload it to MySQL again (the script) and then man.php would retrieve it again?

And by the way:
If I have a number like: 200,84 in MySQL, and I retrieve it and echo it on a page, how can I tell the system to just tell the 200 , not 209 or 200.84. Just the 'big' number?