0
//would like to make an implode that returns the numbers in the following order 1,2,3
class Users extends DB{
//extende a classe de conexao com a database
static function getIds($user_id){
$select = self::getConn()->prepare('SELECT id FROM `users`');
$select->execute(array($user_id));
$d['data'] = $select->fetchAll(PDO::FETCH_ASSOC);
return $d;
}
}
//classe de ids dos usuarios "Users"
$user_id = 1;
$uid = Users::getIds($user_id);
foreach($uid['data'] as $k){
$arr_ids = array('id' => $k);
var_dump($arr_ids);
//tentei usar o implode(',', $arr_ids['id']); e não retornou 1,2,3
/*ira imprimir:
array (size=1)
0 =>
array (size=1)
'id' => string '1' (length=1)
array (size=1)
0 =>
array (size=1)
'id' => string '2' (length=1)
array (size=1)
0 =>
array (size=1)
'id' => string '3' (length=1)
*/
}