Alright, so I'm querying the DB and generating an array from a list of IP addresses:
$q = 'SELECT ip FROM proxy';
$r = mysqli_fetch_all($con->query($q), MYSQLI_ASSOC);
Array returned looks like this:
Array
(
[0] => Array
(
[ip] => 1.202.244.222
)
[1] => Array
(
[ip] => 1.226.238.136
)
[2] => Array
(
[ip] => 1.228.231.247
)
[3] => Array
(
[ip] => 1.238.106.137
)
[4] => Array
(
[ip] => 1.238.155.191
)
But if I want to find say the first or any IP in the above list, for some reason it doesn't find anything:
$ip = "1.202.244.222";
if(in_array($ip,$r)) {
echo "gotcha";
}
What am I doing wrong here?