Okay, I created a test file so that I could work with my results a little easier and it would be more consistent with what I'm asking help for.
Here's the new URL:
My Test Database Source
Here's the current code (all compiled into 1 php file)
<?php
// Establish our connection and select our database
$link = mysql_connect($db_host, $db_user, $db_passwd) or die ("Could not connect to desired database.");
mysql_select_db($db_name) or die ("Could not select desired database.");
## Performing a query to find all the ingredients of the ZG loot system, including the
## event days where the names match up for both tables
$coincount = "
SELECT COUNT(c.coins) coins,
COUNT(c.bijous) bijous, COUNT(c.primals) primals,
COUNT(c.common) common, COUNT(c.rares) rares,
COUNT(c.epics) epics,
a.name name, a.class class, a.guid aGuid, b.guid bGuid,
c.guid cGuid, b.ed_zg events, c.coins loot1,
c.bijous loot2, c.primals loot3, c.common loot4,
c.rares loot5, c.epics loot6
FROM `fab_id` AS a
INNER JOIN `fab_total` AS b
ON a.guid=b.guid
INNER JOIN `fab_zg` AS c
ON a.guid=c.guid
GROUP BY a.name, a.guid ASC";
$coinresult = mysql_query($coincount);
$num=mysql_numrows($coinresult);
## Get Variable for the ZG System percentages
$varcoins = "SELECT * FROM `".VALUE."`";
$varresult = mysql_query($varcoins);
$coinperc = mysql_result($varresult, 0, "zgcoins");
$bijouperc = mysql_result($varresult, 0, "zgbijous");
$primalperc = mysql_result($varresult, 0, "zgprimals");
$commonperc = mysql_result($varresult, 0, "zgcommon");
$rareperc = mysql_result($varresult, 0, "zgrares");
$epicperc = mysql_result($varresult, 0, "zgepics");
## Search through the queries and sort the information
## Information sorted by item type and is then plugged
## into the FAB loot system formula
$i=0;
while ($i < $num) {
$name=mysql_result($coinresult,$i,"name");
$class=mysql_result($coinresult, $i, "class");
// Now plug the variables for numbers of types of items gained
$coins=mysql_result($coinresult,$i,"coins");
$bijous=mysql_result($coinresult,$i,"bijous");
$primals=mysql_result($coinresult,$i,"primals");
$common=mysql_result($coinresult,$i,"common");
$rares=mysql_result($coinresult,$i,"rares");
$epics=mysql_result($coinresult,$i,"epics");
// Now plug the variables for name types on loot
$loot1=mysql_result($coinresult,$i,"loot1");
$loot2=mysql_result($coinresult,$i,"loot2");
$loot3=mysql_result($coinresult,$i,"loot3");
$loot4=mysql_result($coinresult,$i,"loot4");
$loot5=mysql_result($coinresult,$i,"loot5");
$loot6=mysql_result($coinresult,$i,"loot6");
// Now plug the number of events
$events=mysql_result($coinresult,$i,"events");
// Now formalize the percentages for each item gained
$coincip=round((($coins/($events * $coinperc)) * 100),2);
$bijoucip=round((($bijous/($events * $bijouperc)) * 100),2);
$primalcip=round((($primals/($events * $primalperc)) * 100),2);
$commoncip=round((($common/($events * $commonperc)) * 100),2);
$rarecip=round((($rares/($events * $rareperc)) * 100),2);
$epiccip=round((($epics/($events * $epicperc)) * 100),2);
echo "<hr>$name, $class, $events, $coins, $bijous, $primals, $common, $rares, $epics</hr>";
$i++;
}
?>
I went back to the old code with some modifications because it worked better. The new code caused a gap problem, and still counted exactly the same as the mysql select I'm using in the code here. So, even if the gap was fixed in the table, it was still basically counting up the same way.
So, the code above works 90% (10% being that the counts are occurring in the following fashion):
Drabin should be listed as:
Drabin > Mage > 7 > 3 > 1 > 0 > 1 > 2 > 0
Instead he shows as:
Drabin > Mage > 7 > 3 > 3 > 3 > 3 > 3 > 3
So, it appears that the count used in the Select statement is simply returning the first column on count and ignoring that it needs to count the other columns. So, this is the basic problem. This is what needs to be sorted out.
So, how can I adjust the Select statement above so that it actually counts the columns correctly?
Thanks..