SQL returns non-array value in PHP
- by DeadMG
$request = 'SELECT * FROM flight WHERE Id = \''.$_SESSION['LFLightRadio'].'\'';
$data = mysql_fetch_array(mysql_query($request, $SQL));
echo '<table class="table">';
foreach($data as $key => $value) {
echo '<th class="head" align="center" height="19">'.$key.'</th>';
}
echo '<tr>';
foreach($data as $key => $value) {
echo '<td class="cell" align="center" height="19">'.$value.'</td>';
}
echo '</tr></table>';
I know that the LFlightRadio value is set, and is a value returned by the Id value of a previously returned row from the flight database. So within "flight", a record definitely exists with this Id. But, this still gives me a non-array result, so that when I try to use foreach on it, it errors out. Suggestions?