我有一个类似下面的函数,它将从数据库中选择一些不同的值。在将数组传递给其他函数之前,需要编辑其中一个值。
问题是我不知道如何返回带有已编辑元素的数组。如何编辑数组中的值并返回完整的数组但使用编辑的元素?
function eGetDashboard($eID, $pdo) {
$dashboard = PDOjoin('event', 'event.*, join_category_event.*, join_event_user.*, _dashboard.*, _dashboard_icons.*', array(
array('LEFT JOIN' => 'join_category_event', 'ON' => 'event.id_event = join_category_event.id_event'),
array('LEFT JOIN' => 'join_event_user', 'ON' => 'event.id_event = join_event_user.id_event'),
array('LEFT JOIN' => '_dashboard', 'ON' => 'join_category_event.id_category = _dashboard.id_category'),
array('LEFT JOIN' => '_dashboard_icons', 'ON' => 'join_category_event.id_category = _dashboard_icons.id_category')
), array('event.id_event' => $eID), $pdo);
foreach ($dashboard as $eDashboard)
$label = eSetDashboardLabel($eDashboard['multimedia_descr'], getLang());
return $dashboard;
}
function eSetDashboardLabel($label, $lang) {
$label = explode(";", $label);
foreach ($label as $labels) {
if (substr($labels, 1, 2) == $lang)
return substr($labels, 4);
}
}