Hi,
I'm working an a members information module and I'm a little stuck. Note I'm fairly clueless at PHP
So far I have the following function
function membersinfo()
{
$blob = "";
$count = 0;
$guild ="";
$result1 = $this -> bot -> db -> select("SELECT nickname, last_seen FROM #___users WHERE user_level = " . MEMBER . " ORDER BY nickname ASC");
$result2 = $this -> bot -> db -> select("SELECT alt FROM #___alts ORDER BY main ASC");
$result3 = $this -> bot -> db -> select("SELECT COUNT(DISTINCT main) FROM #___alts");
if (!empty($result1))
{
$inside = "##blob_title##:::: Guild Member Stats ::::##end##\n\n";
foreach ($result1 as $val)
{
$count++;
}
$inside .= "There are " .$count. " members in ".$guild."\n";
}
if (!empty($result2))
{
$count2=0;
foreach ($result2 as $val)
{
$count2++;
}
$inside .= "There are " .$count2. " alts in ".$guild."\n";
}
if (!empty($result3))
{
$inside .= "There are " .$result3. " mains in ".$guild."\n";
}
$blob = " :: " . $this -> bot -> core("tools") -> make_blob("click to view", $inside);
return $blob;
}
Now the first 2 return the right results but the last one doesn't.
So far I've tried
Pulling all the names of mains from the db then trying to array_unique them - that showed the value as the same as alts (meaning it wasn't stripping out the duplicates)
Pulling it in as shown and displaying the result directly - This results in the blob having "Array" in place of the numeric value
Pulling them in as shown and using an array call to display all values in the array - This results in the blob having "Array" in place of the numeric value
Entering $result3 = 55 and this "works" in the sense it returns the value 55 in the blob
The values seems to go from 0 to 1 to "Array" to the same value as the number of alts.
I'm sure it's something very obvious that highlights my lack of PHP skills but after 4 hours working on it I'm losing the will to live.
Someone care to put me out of my misery and explain why it doesn't work the way I think it does and tell me how it does work?
Thanks
Buff