Hey Guys, I am not very good at creating multi-dim arrays, What I am doing is doing a query, returning query results into a array, then for looping the next query based on the 1st array like so: (return_array is just all the oci stuff returning a array back)
$sql = "SELECT DISTINCT(WEBREQUESTCLASS) FROM aradmin.helpdeskproblemtype WHERE WEBREQUESTCLASS is not NULL";
$main = return_array($sql);
foreach($main as $test) {
$sql = "SELECT DISTINCT(WEBREQUESTCATEGORY) from helpdeskproblemtype where webrequestclass = '$test'";
$stmt = ociparse($con,$sql);
ociexecute($stmt);
$nrows = OCIFetchStatement($stmt,$results);
if ( $nrows > 0 ) {
while ( list( $key, $val ) = each( $results ) ) {
//print "$key";
}
for ( $i = 0; $i < $nrows; $i++ ) {
reset($results);
while ( $column = each($results) ) {
$data = $column['value'];
print "$test:$data[$i]\n";
}
}
}
}
print_r($return_array);
***********************************************************
Doing a print_r returns this:
Database:
Software Application:Crystal Enterprise
Software Application:Oracle Applications
Software Application:Remedy
Software Application:Visionael
UK Software Application:Crystal Enterprise
UK Software Application:Remedy
UK Software Application:Visionael
***********************************************************
If I were to write this by hand I would want like so:
$main[0] = "Software Application";
$main[1] = "Server";
$main[2] = "Network Device";
$main[3] = "Database";
$secondary[0][0] = "Crystal Enterprise";
$secondary[0][1] = "Remedy";
$secondary[0][2] = "Visionael";
$secondary[0][3] = "BUCS";
$secondary[1][0] = "Unix";
$secondary[1][1] = "Windows";
$secondary[2][0] = "IP Device";
$secondary[2][1] = "SS7 Device";
$secondary[2][2] = "X.25 Device";
$secondary[3][0] = "Oracle";
$secondary[3][1] = "SQL Server";
$secondary[3][2] = "MYSQL";
***********************************************************
Note all this data is not complete, just wanted to show snippets.... So basically the 2nd array is the multi array with the 1st element being the string from the 1st array... make sense???
Please Help!!
$sql = "SELECT DISTINCT(WEBREQUESTCLASS) FROM aradmin.helpdeskproblemtype WHERE WEBREQUESTCLASS is not NULL";
$main = return_array($sql);
foreach($main as $test) {
$sql = "SELECT DISTINCT(WEBREQUESTCATEGORY) from helpdeskproblemtype where webrequestclass = '$test'";
$stmt = ociparse($con,$sql);
ociexecute($stmt);
$nrows = OCIFetchStatement($stmt,$results);
if ( $nrows > 0 ) {
while ( list( $key, $val ) = each( $results ) ) {
//print "$key";
}
for ( $i = 0; $i < $nrows; $i++ ) {
reset($results);
while ( $column = each($results) ) {
$data = $column['value'];
print "$test:$data[$i]\n";
}
}
}
}
print_r($return_array);
***********************************************************
Doing a print_r returns this:
Database:
Software Application:Crystal Enterprise
Software Application:Oracle Applications
Software Application:Remedy
Software Application:Visionael
UK Software Application:Crystal Enterprise
UK Software Application:Remedy
UK Software Application:Visionael
***********************************************************
If I were to write this by hand I would want like so:
$main[0] = "Software Application";
$main[1] = "Server";
$main[2] = "Network Device";
$main[3] = "Database";
$secondary[0][0] = "Crystal Enterprise";
$secondary[0][1] = "Remedy";
$secondary[0][2] = "Visionael";
$secondary[0][3] = "BUCS";
$secondary[1][0] = "Unix";
$secondary[1][1] = "Windows";
$secondary[2][0] = "IP Device";
$secondary[2][1] = "SS7 Device";
$secondary[2][2] = "X.25 Device";
$secondary[3][0] = "Oracle";
$secondary[3][1] = "SQL Server";
$secondary[3][2] = "MYSQL";
***********************************************************
Note all this data is not complete, just wanted to show snippets.... So basically the 2nd array is the multi array with the 1st element being the string from the 1st array... make sense???
Please Help!!