Since I moved to PHP 7 it has been a nightmare of errors for all my old code. The following is the latest one and I am not seeing what the problem is. Notice : Array to string conversion in…
All I am doing is sending two values to a function and returning a value to be displayed. I can’t post the site but here is a small snippet of what shows:
Strength: 996,904 [Rank: Array] …this should be a number.
Here is my code:
echo “number_format($ir[‘strength’]).” [Rank: “.get_rank($ir[‘strength’], ‘strength’).”]";
It is the get_rank part where I am getting the error.
$ir[‘strength’] is a number retrieved from mysql and ‘strength’ is just a string that corresponds to the name in the mysql table.
This is the get_rank function:
function get_rank($stat, $mykey) {
global $db, $ir,$userid,$c;
$q=$db->query(“SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid
WHERE us.$mykey > $stat AND us.userid != $userid AND u.userlevel != 0”) ;
return $db->fetch_single($q);
}
Thanks for any help…