Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. function GetMessagesUsers($to_id, $from_id) {
  2. global $db;
  3.  
  4. $result = array();
  5.  
  6. if (empty($to_id) && empty($from_id)) {
  7. return false;
  8. }
  9.  
  10. $db->where('to_id', $from_id);
  11. $db->where('from_id', $to_id);
  12. $db->orWhere('to_id', $to_id);
  13. $db->orWhere('from_id', $from_id);
  14. $db->orderBy('id', 'DESC');
  15.  
  16. $fetched_data = $db->getOne(T_MESSAGES);
  17.  
  18. $result = array(
  19. 'id' => $fetched_data['id'],
  20. 'user_id' => $fetched_data['to_id'],
  21. 'from_id' => $fetched_data['from_id'],
  22. 'text' => $fetched_data['text'],
  23. 'media' => $fetched_data['media'],
  24. 'stickers' => $fetched_data['stickers'],
  25. 'time' => $fetched_data['time'],
  26. 'read_state' => $fetched_data['seen']
  27. );
  28.  
  29. return $result;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement