Okay... I've now stared at this thing for another 4 and half hours. I have it worked down to "simply" sorting the array I have built to get the results I want.
Here's what I got so far... it's kinda long, and basicly ugly, and IF I can get the damn thing to sort it'll work... I'm not sure I care about anything else right now. grins
So, if anyone can help out with the sorting of the array issue I would appreciate it... I'm going to edit the title of the thread to reflect the direction change of help needed.
curses lousy sort.
$alphanum = $db->sql_numrows($alpharesult = $db->sql_query("SELECT countryname,countrynum,max(date)
AS date FROM ".$prefix."_".$table."
GROUP BY countryname,countrynum"));
$alpharow = mysql_fetch_array($alpharesult);
$a = 0;
while ($a < $alphanum) {
$alphalist[$a]['countryname'] = mysql_result($alpharesult,$a,"countryname");
$alphalist[$a]['countrynum'] = mysql_result($alpharesult,$a,"countrynum");
$alphalist[$a]['date'] = mysql_result($alpharesult,$a,"date");
$a++;
}
$b = 0;
while ($b < $alphanum) {
$countryname = $alphalist[$b]['countryname'];
$countrynum = $alphalist[$b]['countrynum'];
$date = $alphalist[$b]['date'];
$betaresult = $db->sql_query("SELECT * FROM ".$prefix."_".$table." WHERE date=$date");
$alphalist[$b]['troops'] = mysql_result($betaresult,0,"troops");
$b++;
}
// this little piece of code is from
[url]http://www.php.net/manual/en/function.array-multisort.php[/url] I was having trouble with my sort and thought it might help.
foreach ($alphalist as $key => $row) {
$countryname[$key] = $row["countryname"];
$countrynum[$key] = $row["countrynum"];
$date[$key] = $row["date"];
$troops[$key] = $row["troops"];
}
array_multisort($troops, SORT_DESC);
Thoughts, comments, sarcastic remarks?
EDIT: Apparently you cannot edit the main title of a thread after creation... grrr!