The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
hot to get user ids from database to array - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.4 (https://userspice.com/forums/forumdisplay.php?fid=27)
+--- Thread: hot to get user ids from database to array (/showthread.php?tid=1391)



hot to get user ids from database to array - Vtins - 03-21-2019

Hi,
i have a problem with my array_filter
Example i need all usernames or ids for the array_filter like the $filter examples

How can i get all ids into this format

thanks a lot for checking my thread

PHP Code:
$filter = array("1","2","3"); 
or

PHP Code:
$filter = [1,2,3]; 

array_filter example
PHP Code:
$filter = array("1","2","3");
$filter = [1,2,3];
                
$filtered 
array_filter($responseData['json'], function ($item) use ($filter) {
return 
in_array($item['id'], $filter);
}); 
admins please move my thread At


RE: hot to get user ids from database to array - Brandin - 03-21-2019

Hi there,

You will need to fetch all the users using the fetchAllUsers function. Loop them and enter them into an array. Example:
https://pastebin.com/KeFfDp7x

Thank you,
Brandin.


RE: hot to get user ids from database to array - Vtins - 03-21-2019

(03-21-2019, 04:58 PM)Brandin Wrote: Hi there,

You will need to fetch all the users using the fetchAllUsers function. Loop them and enter them into an array. Example:
https://pastebin.com/KeFfDp7x

Thank you,
Brandin.

Hi Brandin,

Thats what i need Smile)
Thanks a lot


RE: hot to get user ids from database to array - mygeekshelp - 04-04-2019

Use PHP My insteed normal JS code.