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
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fetch data from DB
#5
This code will dump out the names of the groups the logged in user belongs to. Give it a try and come back with any questions.

<pre>
Code:
$db = DB::getInstance();
$query = $db->query("SELECT * FROM user_permission_matches WHERE user_id = ?", array($user->data()->id));
$x = $query->results(true);
//dump($x);
foreach ($x as $y){
    //dump($y);
    $perm_id=$y["permission_id"];
    $query = $db->query("SELECT * FROM permissions WHERE id = ?", array($perm_id));
    $z = $query->results(true);
    //dump($z[0]);
    $perm_name=$z[0]["name"];
    echo $perm_name.'<br/>';;
}
</pre>
  Reply


Messages In This Thread
Fetch data from DB - by jjmmrg - 03-13-2016, 01:51 PM
Fetch data from DB - by jjmmrg - 03-14-2016, 02:51 AM
Fetch data from DB - by jjmmrg - 03-14-2016, 03:15 AM
Fetch data from DB - by jjmmrg - 03-14-2016, 04:31 AM
Fetch data from DB - by brian - 03-14-2016, 01:10 PM
Fetch data from DB - by mudmin - 03-14-2016, 02:05 PM
Fetch data from DB - by brian - 03-14-2016, 02:12 PM
Fetch data from DB - by jjmmrg - 03-15-2016, 03:16 AM
Fetch data from DB - by jjmmrg - 03-15-2016, 03:20 AM
Fetch data from DB - by jjmmrg - 03-15-2016, 04:37 AM
Fetch data from DB - by brian - 03-15-2016, 01:19 PM
Fetch data from DB - by jjmmrg - 03-16-2016, 03:17 AM
Fetch data from DB - by jjmmrg - 03-16-2016, 09:06 AM
Fetch data from DB - by brian - 03-16-2016, 12:21 PM
Fetch data from DB - by astropos - 03-16-2016, 04:25 PM
Fetch data from DB - by mudmin - 03-17-2016, 12:03 AM
Fetch data from DB - by brian - 03-17-2016, 03:07 PM
Fetch data from DB - by jjmmrg - 03-18-2016, 02:54 AM
Fetch data from DB - by jjmmrg - 03-18-2016, 02:55 AM
Fetch data from DB - by jjmmrg - 03-18-2016, 02:56 AM
Fetch data from DB - by jjmmrg - 03-18-2016, 03:31 AM
Fetch data from DB - by mudmin - 03-18-2016, 12:54 PM
Fetch data from DB - by jjmmrg - 03-19-2016, 03:51 AM
Fetch data from DB - by mudmin - 03-19-2016, 04:41 PM
Fetch data from DB - by jjmmrg - 03-21-2016, 08:19 PM
Fetch data from DB - by mudmin - 03-21-2016, 10:54 PM
Fetch data from DB - by jjmmrg - 03-22-2016, 02:56 AM
Fetch data from DB - by jjmmrg - 03-22-2016, 02:58 AM
Fetch data from DB - by mudmin - 03-22-2016, 04:41 AM
Fetch data from DB - by jjmmrg - 03-22-2016, 04:43 AM
Fetch data from DB - by jjmmrg - 03-22-2016, 11:35 AM
Fetch data from DB - by jjmmrg - 03-22-2016, 11:58 AM
Fetch data from DB - by mudmin - 03-22-2016, 01:49 PM
Fetch data from DB - by jjmmrg - 03-22-2016, 01:56 PM
Fetch data from DB - by mudmin - 03-22-2016, 02:20 PM
Fetch data from DB - by jjmmrg - 03-22-2016, 03:44 PM
Fetch data from DB - by brian - 03-22-2016, 04:02 PM
Fetch data from DB - by brian - 03-22-2016, 04:33 PM
Fetch data from DB - by brian - 03-22-2016, 04:50 PM
Fetch data from DB - by mudmin - 03-22-2016, 05:19 PM

Forum Jump:


Users browsing this thread: 19 Guest(s)