-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_sql.php
More file actions
48 lines (48 loc) · 966 Bytes
/
select_sql.php
File metadata and controls
48 lines (48 loc) · 966 Bytes
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
<?php
include("./connection.php");
$items = [];
$tables = array(
"Account" => [],
"Employee" => [],
"Record" => [],
);
$account_sql = "SELECT
`user`.id,
`user`.`name`,
`user`.u_id,
`user`.class,
`user`.email,
`user`.`password`,
`user`.gender
FROM
`user`";
$account_query = mysqli_query($connection, $account_sql);
while ($item = mysqli_fetch_assoc($account_query)) {
array_push($tables['Account'], $item);
}
$employee_sql = "SELECT
post.id,
post.title,
post.author,
post.content,
post.create_time,
post.user_id
FROM
post
";
$employee_query = mysqli_query($connection, $employee_sql);
while ($item = mysqli_fetch_assoc($employee_query)) {
array_push($tables['Employee'], $item);
}
$record_sql = "SELECT
store.id,
store.`name`,
store.address,
store.phone
FROM
store";
$record_query = mysqli_query($connection, $record_sql);
while ($item = mysqli_fetch_assoc($record_query)) {
array_push($tables['Record'], $item);
}
echo json_encode($tables);