-2

未定义索引:first_name

$view = $user->VIEW_EMP($connect);
    if (is_array($view)) {
        foreach($view as $key => $value){
            echo $view['first_name'];
        }
    }

功能:

static function VIEW_EMP($db){
    $sql = "SELECT * from employees LIMIT 0, 30 ";
    if($output = mysql_query($sql)):
            $columns = array();
            while($result = mysql_fetch_assoc($output)):
                $columns[] = $result;
            endwhile;
        endif; 
       return $columns;
    }
4

1 回答 1

2

似乎错字。

echo $view['first_name'];

应该

echo $value['first_name'];
于 2013-03-07T16:55:16.093 回答