Created
November 25, 2016 17:12
-
-
Save ZaeemSattar/86e18d9725ffc6a7f83ae9d2f866be24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$conn = new mysqli("localhost", "example", "password", "yourDB"); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed: " . $conn->connect_error); | |
echo 'error hai'; | |
} | |
$sql ="SELECT * from Rooms"; | |
$result = $conn->query($sql); | |
$rooms= array(); | |
while($row = $result->fetch_assoc()) | |
{ | |
$obj= array(); | |
array_push($obj,$row['rid']); | |
array_push($obj,$row['room_name']); | |
array_push($rooms,$obj); | |
} | |
echo json_encode($rooms); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment