I think this is just something I haven't come across before!
$r = $database->currentChallengers($f, $g);
while($row=mysql_fetch_assoc($r))
{
$u[]=$row['username'];
$i[]=$row['userid'];
$s[]=$row['streak'];
}
for ($i = 0; $i < count($u); $i++)
{
foreach ($u as $user)
{
echo "Challenger: $u[$i]";
}
}
That PHP is for the following database query:
function currentChallengers($f, $g)
{
$q = "SELECT k.userid, k.streak, u.username
FROM ".TBL_KOTH." k
INNER JOIN ".TBL_USERS." u
ON k.userid = u.id
WHERE k.format = '$f' && k.game = '$g' && k.king = '0' && k.done = '0'
ORDER BY k.userid";
return mysql_query($q, $this->connection);
}
I am getting the error
Fatal error: [] operator not supported for strings
On the line
$u[]=$row['username'];
Could anyone tell me why this is happening? Also, should the code I have written list each username from the query? Thanks