SQL returns non-array value in PHP

Posted by DeadMG on Stack Overflow See other posts from Stack Overflow or by DeadMG
Published on 2010-05-07T17:28:12Z Indexed on 2010/05/07 19:28 UTC
Read the original article Hit count: 215

Filed under:
|
    $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?

© Stack Overflow or respective owner

Related posts about php

Related posts about sql