Ok, I've written the following to test the retreival of data and then summing the populations of two test nations. For some reason it errors and says there's an unexpected } at line 65, which is marked below.
<?php
######################################################
#TERRA VOSEM: POLITICAL SIMULATION
#
#Copyright (c) 2005 Jacob Hickey (influensi@gmail.com
#http://www.zifos.com
#
#This is the very first ever test of the most basic Terra Vosem prototype.
######################################################
//Connecting to the database
$dbhost = "mysql3.ixwebhosting.com";
$dbuname = "zzwiebe_jake";
$dbpass = "yeahman";
$dbname = "zzwiebe_nuke";
$dbcnx = @mysql_connect($dbhost, $dbuname, $dbpass);
if (!$dbcnx) {
echo '<p>The servers broken!!</p>';
exit();
}
$database = @mysql_select_db($dbname);
if (!$database) {
exit('<p>Damn it all to hell! ' .
'The database has exploded.</p>');
}
$terrs = @('SELECT FROM tv_terr');
if (!$terrs) {
exit('<p>PROBLEM BLINK! ' .
mysql_error() . '</p>');
}
$nations = @('SELECT FROM tv_nations');
if (!$nations) {
exit('<p>PROBLEM BLINK! ' .
mysql_error() . '</p>');
}
$numterrs = mysql_numrows($terrs);
$numnations = mysql_numrows($nations);
$id=1;
while ($id < $numterrs) {
$terrnames[$id] = mysql_result($terrs, $id, "terrname");
$populationdata[$id] = mysql_result($terrs, $id, "population");
$bonusdata[$id] = mysql_result($terrs, $id, "bonus");
$owner[$id] = mysql_result($terrs, $id, "uid");
$id++;
}
$j=1;
while ($j < $numnations) {
$id=1;
while($id < $numterrs) {
if($owner[$id] == $j) {
$population[$j] += $populationdata[$id];
$bonus[$j] += $bonusdata[$id];
}
$id++
} //THIS IS LINE 65
$j++
}
echo "Tenebricosis's population is $population[1]";
echo "The other population is $population[2]";
mysql_close($dbcnx);
?>
Am I not allowed to have a nested loop, or what?