-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_lobby.php
More file actions
22 lines (18 loc) · 787 Bytes
/
get_lobby.php
File metadata and controls
22 lines (18 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
//open connection to mysql db
$connection = mysqli_connect("localhost","TopJamAdmin","topjam","TopJam") or die("Error " . mysqli_error($connection));
$jsondata = file_get_contents('php://input');
$data = json_decode($jsondata, true);
$lobby_name = $data['lobby_name'];
$lobby_password = $data['lobby_password'];
//fetch table rows from mysql db
$sql = "select * from Lobby where lobby_name = '$lobby_name' AND lobby_password = '$lobby_password'";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
//create an array
$songarray = array();
while($row =mysqli_fetch_assoc($result))
{
$songarray[] = $row;
}
echo json_encode($songarray);
?>