I'm trying to get the IP out of the database and split them in different arrays so I can count the amount of clients in every country, and put them in a europe map chart.
Now I am stuck on the part where I split the countries into different arrays.
$result_ip = $dbhandle->query("SELECT ip FROM email;");
$row_cnt_ip = $result_ip->num_rows;
$NL = array('');
$AL = array('');
$NO_EU = array('');
$ip = $result_ip;
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
while($r = $details->country->fetch_array(MYSQLI_ASSOC)):
for($i = 1; $i < $row_cnt_ip; $i++) {
switch ($details->country) {
case "NL": //Netherlands
array_push($NL,"$details->country");
break;
case "AL": //Albania
array_push($AL,"$details->country");
break;
default;
array_push($NO_EU,"$details->country");
break;
}
}
endwhile;
The error I am getting is:
Catchable fatal error: Object of class mysqli_result could not be converted to string
Can anyone help me figuring out what the problem is?