I'm working with a database that has about 60 columns. I need to check to see that there are values in each column.
Is there a way to loop through the columns in php as apposed to looping through the rows?
Something like:
while (column['$i'] = 'x') {
echo 'column name';
$i++;
}
where i would be a column name and not a number.
Oracle - Loop through column names
Moderator: General Moderators
-
dimxasnewfrozen
- Forum Commoner
- Posts: 84
- Joined: Fri Oct 30, 2009 1:21 pm
-
dimxasnewfrozen
- Forum Commoner
- Posts: 84
- Joined: Fri Oct 30, 2009 1:21 pm
Re: Oracle - Loop through column names
Ah HA!
I figured it out:
So ultimately, I get the number of rows, then loop through the columns for each row which in this case is an associative array considering Oracles query functions store it that way.
I figured it out:
Code: Select all
for ($j = 0; $j < $nrows; $j++ ) {
foreach( $results as $key => $value){
if ($value[$j] == 'X') {
echo $key . "<br />";
}
}
}