1

I know there is so many questions regarding my question, but I didn't find the solution.

I have Oraacle SQL loop data:

$array = array();
$qAccessModule = oci_parse($c1, "
    SELECT
    M.MODULEID,
    M.MODULENAME,
    M.MODULELINK,
    AM.MODULEID_FK,
    AM.GROUPID_FK,
    AM.CHKSTATUS
    FROM
    WA_GA_TBL_MODULES M,
    WA_GA_TBL_ACCESSMODULES AM
    WHERE
    M.MODULEID = AM.MODULEID_FK AND
    AM.GROUPID_FK = '" . $getGroupIDFK . "' AND
    M.MODULELINK = 'designationManagement'
");
oci_execute($qAccessModule);
while($dAccessModule = oci_fetch_array($qAccessModule))
{
    $array[] = $dAccessModule['CHKSTATUS'];
}

echo $array;

When I echoing the $array, the result is array.

What I want is get the data from looping then make it to be array, example:

$array = array("CREATE", "EDIT");

and later will be used for:

if(in_array("CREATE", $array))
{
    echo "Got Irix";
}
2
  • 1
    USE print_r . echo dont work on array. Commented Mar 7, 2017 at 7:10
  • The $array will be used for: if(in_array("CREATE", $array)) Commented Mar 7, 2017 at 7:12

1 Answer 1

1

Please use [print_r][1] instead of [echo][1] use print_r($array);

Sign up to request clarification or add additional context in comments.

5 Comments

Later $array will be used for: if(in_array("CREATE", $array)) { echo "Got Irix"; }
what is the output you get when using print_r
this is the output: Array ( [0] => CREATE [1] => VIEW )
And you are not getting "Got Irix" from in_array then try trimming the array while inserting to $array, use $array[] = trim($dAccessModule['CHKSTATUS']);
Working perfect. Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.