-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_user.php
More file actions
22 lines (18 loc) · 768 Bytes
/
get_user.php
File metadata and controls
22 lines (18 loc) · 768 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("Can't connect to DB" . mysqli_error($connection));
$jsondata = file_get_contents('php://input');
$data = json_decode($jsondata, true);
$username = $data['username'];
$password = $data['password'];
//fetch table rows from mysql db
$sql = "select * from Users where username = '$username' AND password = '$password'";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
//create an array
$userarray = array();
while($row =mysqli_fetch_assoc($result))
{
$userarray[] = $row;
}
echo json_encode($userarray);
?>