I'm trying to make an array with the structure like so:
[
{
"ips":
"xxx.xxx.xxx.xx",
"yyy.yyy.yyy.yy",
"zzz.zzz.zzz.zz"
"ai":
"xxx.xxx.xxx.xx",
"yyy.yyy.yyy.yy"
}
]
So I can check if variable with string is inside array. But I'm collecting the IP's from a DB using mysql, and am not sure how to insert the IP's.
I've tried this:
$whitelist = array(
'ips' => array(),
'ai' => array()
);
// sql command
$sql = "SELECT `ip` FROM `testers`";
$res = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($res)) {
array_push($whitelist['ips'],
$row
);
}
Can somebody please tell me how I can do this/ Seriously so lost other then inserting the IP's individually. That would take forever and not easy to track.