For example, if you use the usual index.php file as the traffic cop that controls the flow of data through your script, then somewhere near the beginning, after your configuration information, place either this code or an include for the file that this code is in.
The script should update everyone's hp when someone accesses the game and the proper amount of time has passed since the last update.
Okay, lets try and see if we missed something else. Some debugging could be in order:
Try something like this:
CODE
mysql_query("<<<INSERT YOUR QUERY HERE>>>") or die('Query failed: ' . mysql_error());
This is a good idea any time you are building a script since it prevents the system from continuing on and it lets you know that there is a propblem.
Another method we can use to check what is going on it by echoing the querys like so:
CODE
$query = "<<<INSERT YOUR QUERY HERE>>>";
mysql_query($query) or die('Query failed: ' . mysql_error());
echo $query;
mysql_query($query) or die('Query failed: ' . mysql_error());
echo $query;
If you want a fancier method of echoing your queries, you can concatenate (link together) all of your queies then output them at the end like so:
CODE
$some_count = 1;
$query = "<<<INSERT YOUR QUERY HERE>>>";
mysql_query($query) or die('Query failed: ' . mysql_error());
$queries .= "$some_count:<br /><pre>$query</pre><br /><br />";
$some_count++;
....
MORE CODE
....
echo $queries;
$query = "<<<INSERT YOUR QUERY HERE>>>";
mysql_query($query) or die('Query failed: ' . mysql_error());
$queries .= "$some_count:<br /><pre>$query</pre><br /><br />";
$some_count++;
....
MORE CODE
....
echo $queries;
This would give you very easy to read query debug information.
Anyway, back to the main event.
It is possible that there is a problem with your PHP code that is breaking your queries in which you might see some strange data in your queries. If this is the case, then try and figure out which section of code generated that query and try and determine why your script is malfunctioning there.
It is also possible that the SQL queries that I have given you are bad! Since I didn't go to the trouble to create the required tables to do a live test with these queries, there could be an error. The error may not cause an error message to be shown if the query just doesn't actually match any of the records as it is written. So, you should copy and paste the queries into phpMyAdmin and manually test each one.
You may need to give us some database structure information so that we can see if there is something we are just overlooking.
Going into your database without selecting any tables to view, select Export and be sure to uncheck the Data checkbox and click Go. All of the other default settings will be fine and this will display the structure of all of your tables in that database. If you copy and paste that in your next reply, then I could see if there is something that I missed in your previous posts about your database. If I can't see it, I can actually use the export data to recreate the structure of your database on my account.
vujsa


