McKaulick, thanks for your post. I have taken it and created a script (not complete yet as you will see) to try and do what I need done. I think I have a good idea of how to do it, I am sure I have syntax errors in the code below. I now need to figure out how to exclude about 8 units that this code should not affect. Not even possitive that I am actually going through the data pulled by the query correctly. Any further help is greatly appreciated.
<?php
//Connect to the database and select the right database
$warcp = mysql_connect('server', 'database', 'password');
@mysql_select_db('database', $warcp);
//Query the database to get the total count for all the units used in the entire mod, also put the results
//of the query into a array
$result = mysql_query("SELECT COUNT(*) AS unit_count, unit_id FROM squads GROUP BY unit_id ORDER BY unit_id ASC");
$unitCount = mysql_fetch_assoc($result);
//Query the database to get the total number of players playing the mod currently
$playerCount = mysql_query("SELECT COUNT(*) FROM players");
$playerCounts = mysql_fetch_assoc($playerCount);
//do the math to calculate each units new resupply per game number. This is the number that will be updated
//in the database.
$resupply = (($unitCount['unit_count'])/($playerCounts))-1;
//Run a query of the current numbers in the Availability table, so we can compare these to the newly calculated numbers
$cResupply = mysql_query("SELECT resupply AS resupply, unit_id FROM Availability GROUP BY unit_id ORDER BY unit_id ASC");
//put the results into an array
$currentResupply = mysql_fetch_assoc($cResupply);
//Run an if statement that will compare the the old numbers with the new numbers to see if we need to update or not
if ($currentResupply['resupply'] != $resupply) {
mysql_query("UPDATE Availability SET resupply = '$resupply'");
echo "The new updated resupply numbers for units that changed are:'$unitCount[unit_id]'$resupply";
} elseif($currentResupply['resupply'] == $resupply) {
echo "The units that did not change are: '$currentResupply[unit_id]'";
}
?>