-
Notifications
You must be signed in to change notification settings - Fork 0
/
getGroups.php
43 lines (33 loc) · 1.07 KB
/
getGroups.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
<?php
// $all_files = glob("images/*.*");
// for ($i=0; $i<count($all_files); $i++)
// {
// $image_name = $all_files[$i];
// $supported_format = array('gif','jpg','jpeg','png');
// $ext = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// if (in_array($ext, $supported_format))
// {
// echo '<img src="'.$image_name .'" alt="'.$image_name.'" />'."<br /><br />";
// } else {
// continue;
// }
// }
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "testingphp";
$conn = new mysqli($servername, $username, $password, $dbname);
if($conn->connect_error){
die("connection failed: " .$conn->connect_errror);
}
$query = "SELECT * FROM groups ORDER BY waitingList";
$result = mysqli_query($conn, $query);
$json_array = array();
if($result->num_rows > 0){
while($row = $result->fetch_assoc()){
array_push($json_array, $row);
}
}
echo json_encode($json_array);
$conn->close();
?>