-
Notifications
You must be signed in to change notification settings - Fork 1
/
getUser.php
70 lines (34 loc) · 1.05 KB
/
getUser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
$servername = "remotemysql.com";
$database = "TRlgHsgbF7";
$username = "TRlgHsgbF7";
$password = "vaGK9Qe8mC";
// Создаем соединение
$conn = mysqli_connect($servername, $username, $password, $database);
$sql = "SELECT `id`, `username` FROM usertbl";
$result = mysqli_query($conn,$sql)
or die(mysqli_error($conn));
$news = array();
while($row = $result->fetch_assoc()) {
$news[] = $row;
}
$sql = "SELECT `id` AS `gid` , `group_name` FROM `groups`";
$result = mysqli_query($conn,$sql)
or die(mysqli_error($conn));
while($row = $result->fetch_assoc()) {
$news[] = $row;
}
$sql = "SELECT user_groups.id AS `ugid`,`username` AS `usernameL` ,`group_name`As `group_nameL`
FROM `usertbl`
JOIN `user_groups` ON usertbl.id = user_groups.id_usertbl
JOIN `groups` ON user_groups.id_group = groups.id
ORDER BY group_name";
$result = mysqli_query($conn,$sql)
or die(mysqli_error($conn));
while($row = $result->fetch_assoc()) {
$news[] = $row;
}
//$news = array_reverse($news);
echo json_encode($news);
mysqli_close($conn);
?>