I'm extremely new to PHP and have run into a bit of a snag. What I am trying to do is run a database query that returns an array. I would like to save the array in a variable so that it can be used in an autosuggest box.
I can echo the array on screen but an unsure on how to save it to a usable variable plus Im getting an Undefined Offset 1 error message on line 25.
function getEmail($conn)
{
$query = "select EMAIL_ADR from COMMON.EMAILS order by EMAIL_ADR";
$emailResults = oci_parse($conn, $query);
oci_execute($emailResults);
while ($list = oci_fetch_array($emailResults))
{
for($i=0; $i<count($list); $i++)
{
echo $list[$i] ."<br />"; //line 25
}
}
}
Any help would be much appreciated!