Can someone please tell me which syntax to use to build the "directory" array from a mysql recordset? Thank you!
$directory = array();
foreach ($resultSetFromDB as $row){
foreach ($row as $field => $value){
$directory[$field][] = $value;
}
}
I can print $field and $value, no problem
Try this:
$directory = array();
foreach ($resultSetFromDB as $i => $row) {
foreach ($row as $field => $value) {
$directory[$i][$field] = $value;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.