我试图使用函数 与前方,但获取错误。这是我的代码:
function student_image_list(){
global $host, $dbname, $user, $pass;
$DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$STH = $DBH->query("SELECT DISTINCT folder_name from school_students_images");
$STH->setFetchMode(PDO::FETCH_ASSOC);
$row = $STH->fetch();
return $row;
}
我要从表格 school_students_images
上打印所有唯一的文件夹名称, 我尝试这样做 :
$folder_name1 = student_image_list();
foreach($folder_name1[ folder_name ] as $folder_name)
{
echo <div class="mws-panel grid_2">
<div class="mws-panel-header">
<span> .$folder_name. </span>
</div>
</div> ;
}
Error Warning: Invalid argument supplied for foreach() in student_image_list_raw.php on line 41 error in this line
foreach($folder_name1[ folder_name ] as $folder_name)
请帮助。