Created
November 25, 2016 17:10
-
-
Save ZaeemSattar/298be9c7b07848c32cc0cf990a8b4e83 to your computer and use it in GitHub Desktop.
This file contains hidden or 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); | |
} | |
$rid=$_POST["room_id"]; | |
$sql ="SELECT * from Messages where rid='$rid'"; | |
$result = $conn->query($sql); | |
$rooms= array(); | |
while($row = $result->fetch_assoc()) | |
{ | |
$obj= array(); | |
array_push($obj,$row['uid']); | |
array_push($obj,$row['rid']); | |
array_push($obj,$row['message']); | |
array_push($obj,$row['username']); | |
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