这是我的db表图像
I Have This code but, the result is this: array:2 [▼ 3 => array:1 [▼ 1 => [] ] 4 => array:1 [▼ 5 => array:1 [▼ 6 => array:1 [▼ 7 => [] ] ] ] ]
But i need organize the code like this: array:[ 0 => 3, 1 => 1, 2 => 4, 3 => 5, 4 => 6, 5 => 7 ]
// actually the parameter id is the session user
public function misSubordinados($id){
$conn = $this->getEntityManager()->getConnection();
$sql = 'SELECT s.id_usuario FROM `sy_supervisores_asesor` AS s
WHERE s.id_supervisor IN (' . implode(',', [$id]) . ')';
$stmt = $conn->prepare($sql);
$stmt->execute();
$total = array();
$result = $stmt->fetchAll();
if(count($result) > 0) {
foreach ($result as $key => $value) {
$total[$value['id_usuario']] = $this->misSubordinados($value['id_usuario']);
}
}
return $total;
}
暂无答案!
目前还没有任何答案,快来回答吧!