Darksoul__

Untitled

May 9th, 2022 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. //query to fetch all users tying to groups
  2.     $query = "  SELECT groupID
  3.                     FROM Users U
  4.                         JOIN
  5.                             Groups_users GU
  6.                                 ON
  7.                                     U.userID = GU.userID
  8.                     WHERE
  9.                         U.userID = '$_SESSION[name]';";
  10.                        
  11.     $result = $db->query($query);
  12.     $groups_ids = $result->fetchAll();
  13.  
  14.     $users_typing=array();
  15.  
  16.     for($i=0;$i<count($groups_ids);$i++){
  17.         $query = "  SELECT groupID,U.nickname
  18.                         FROM Users U
  19.                             JOIN
  20.                                 Groups_users GU
  21.                                     ON
  22.                                         U.userID = GU.userID
  23.                         WHERE
  24.                             GU.is_typing = '1';";
  25.         $result = $db->query($query);
  26.         array_push($users_typing,$result->fetchArray());
  27.     }
Add Comment
Please, Sign In to add comment