Is it possible to check data from table where variable is an array?
Example:
$allowedIP = array();
$qChkIP = oci_parse($c1, "SELECT ALLOWED_IP_ADDRESS FROM WA_BT_TBL_PROFILE WHERE ACTIVE = 'Y'");
oci_execute($qChkIP);
while($dChkIP = oci_fetch_array($qChkIP))
{
$allowedIP = array_merge($allowedIP, array_map('trim', explode(',', $dChkIP['ALLOWED_IP_ADDRESS'])));
}
print_r $allowedIP
Array ( [0] => 192.168.183.205 [1] => 192.168.184.20 [2] => 192.168.184.15 [3] => 192.168.183.28 )
My current IP Address is: 192.168.183.28
and now I want to get detail information from table where ALLOWED_IP_ADDRESS = $allowedIP
SELECT P.ALLOWED_IP_ADDRESS, P.PROFILEID, P.PROFILE_NAME, P.LOCATIONID_FK, L.LOCATIONID, L.LOCATIONNAME FROM WA_BT_TBL_PROFILE P, WA_GA_TBL_LOCATIONS L WHERE P.LOCATIONID_FK = L.LOCATIONID AND P.ACTIVE = 'Y' AND P.ALLOWED_IP_ADDRESS IN (".implode(',',$allowedIP).")
But there is no result.
UPDATED
DATA
PROFILEID PROFILE_NAME ACTIVE DATEADDED ADDEDBY LOCATIONID_FK ALLOWED_IP_ADDRESS
PF0001 Normal Working Day Y 9/30/2017 5:53:39 PM US0001 LC0001 192.168.183.205
PF0004 Ramadhan N 10/12/2017 10:38:02 AM US0001 LC0003
PF0002 Ramadhan N 9/30/2017 5:55:50 PM US0001 LC0001 192.168.183.205
PF0003 Normal Working Day Y 10/3/2017 5:23:05 PM US0001 LC0003 192.168.184.20, 192.168.183.28
I'm using this method from Randall
"... P.ALLOWED_IP_ADDRESS IN ('".implode("','",$allowedIP)."') ..."
and I can see the data but result is not correct. I got "PF0001", should be "PF0003"