forked from TeghSinghJ/Live-Chatting-App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch_data.php
35 lines (24 loc) · 914 Bytes
/
fetch_data.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
<?php
// Include Database connection file
include 'connection.php';
if (isset($_POST['getData']) && !empty($_POST['getData'])) {
$start = $con->real_escape_string($_POST['start']);
$limit = $con->real_escape_string($_POST['limit']);
$query = "SELECT * FROM chat LIMIT $start, $limit";
$result = $con->query($query);
if ($result->num_rows > 0) {
$output = "";
while ($row = $result->fetch_array()) {
$output.="<div class='panel panel-default panel-primary'>
<div class='panel-heading'>
<h4><strong> ".$row['msg']." </strong>
<small style='float:right;color:#fff'>".date("d-M-Y", strtotime($row['ch_timestamp']))."</small>
</h4>
</div>
<div class='panel-body'><p style='font-size:17px;'> ".$row['incoming_id']." </p></div>
</div>";
}
echo $output;
}
}
?>