Page 1 of 1

Populating an array with database column

Posted: Tue Jul 13, 2004 11:22 am
by FreeBaGeL
I'm looking to populate an array in php with a column from my database for later use.

More specifically, I'm trying to make an array that will store all the ID's from a table in my database using an ORACLE database.

Here's what I've got so far, not sure why it's not working, but when I print back the values of the array they're all empty:

Code: Select all

$detailsID = OCIParse($connect, 'select DTL_ID from mgargano.events_dtl order by DTL_ID');
@OCIExecute($details, OCI_DEFAULT);

$arrID=array();
$i=0;

  while(OCIFetchInto($detailsID, $arrIDTemp, OCI_ASSOC+OCI_RETURN_NULLS))
  {
    $arrID[$i]=$arrIDTemp['DTL_ID'];
    $i++;
  }

Posted: Tue Jul 13, 2004 11:41 am
by feyd
it appears like it'd work.. looking at the documentation for the function... have you checked your error logs, maybe there's something you missed..

Posted: Tue Jul 13, 2004 12:44 pm
by Weirdan
I'm not familiar with Oracle, but it seems to me you're parsing the statement into $detailsID but executing the $details statement.

Posted: Tue Jul 13, 2004 12:49 pm
by Weirdan
what if:

Code: Select all

$detailsID = OCIParse($connect, 'select DTL_ID from mgargano.events_dtl order by DTL_ID');
@OCIExecute($detailsID, OCI_DEFAULT);
$arrID=array();
while( list($tmp) = oci_fetch_row($detailsID) ) $arrID[] = $tmp;