Few data from database in one variable php?

I need to select data received from the database was recorded in one variable.
So it was like $idak = ['00321','123','123'];

Get the data now -_-
$GetgaremUser = R::find( 'usersruletka', 'id_room = ?', [$chat_id]);
 foreach ($GetgaremUser as $usergarem) { //Cycle.
 $strtopall .= "@id{$usergarem['user_id']} ({$usergarem['user_name']}) from {$usergarem['dateinv']}<br>";
$countgaremok++;
 }


The database gives for example 3 lines. I get them through Tikal. and I need to in this cycle. cell user_id recorded in the variable $idak make it look so $idak = ['00321','123','123']; - in it are 3 pieces of data from different lines!

$GetgaremUser = R::find( 'usersruletka', 'id_room = ?', [$chat_id]);
 foreach ($GetgaremUser as $usergarem) { //Cycle.
 $strtopall .= "@id{$usergarem['user_id']} ({$usergarem['user_name']}) from {$usergarem['dateinv']}<br>";
 $idak .= "{$usergarem['user_id']},";
$countgaremok++;
 }

Added $idak .= "{$usergarem['user_id']},"; - current it does not record as I need. I need it to be, and it was possible to work with them. $idak = ['00321','123','123'];

Not a Fig did not understand how to use in my case www.php.su/functions/?list
April 3rd 20 at 18:45
2 answers
April 3rd 20 at 18:47
Solution
Before Cicala:
$idak = [];
And cicale already:
$idak[] = $usergarem['user_id'];
Thanks it seems to work. Otoh I reinvent the wheel sat )))
/*if($idrules1 == 0){
 $idrules1 = $usergarem['user_id'];
 } else{
 $idrules2 = $usergarem['user_id'];
 }*/
Sorry that I tried so data write) get it everyday, the current through $dskau .= $usergarem['user_id']; - Romaine commented on April 3rd 20 at 18:50
How to verify a match? otoh I have that is not working if (in_array($idak,$id)) - in $id to hranyatsya other data that need to be looking at with $idak - how ? - Romaine commented on April 3rd 20 at 18:53
April 3rd 20 at 18:49

Find more questions by tags PHP