You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$query = "select *,c.first_name,c.last_name,c.txtphone,p.project_name from crm_notifications as n left JOIN crm_clients as c ON c.client_id=n.client_id left JOIN crm_projects as p ON p.project_id=n.project_id WHERE c.first_name LIKE :first_name AND c.last_name LIKE :last_name AND n.client_phone LIKE :client_phone AND n.txtmessage LIKE :txtmessage AND n.direction LIKE :direction AND n.message_status LIKE :message_status AND n.created_at LIKE :created_at ORDER BY created_at DESC";
notification.php
<script> $(function() { $('#grid_table').jsGrid({ width: "100%", height: "auto", selecting:true, filtering:true, inserting:false, editing: false, sorting: true, paging: true, autoload: true, pageSize: 15, pageButtonCount: 5, controller: { loadData: function(filter){ return $.ajax({ type: "GET", url: "fetch_data.php", data: filter }); }, }, fields: [ { name: "first_name", type: "text", title: "First Name", }, { name: "last_name", type: "text", title: "Last Name", }, { name: "client_phone", type: "text", title: "Client Phone", }, { name: "txtmessage", type: "text", title: "Message", width:"30%", }, { name: "direction", type: "text", title: "Direction", filtering: true, width:"10%", }, { name: "message_status", type: "text", title: "Status", filtering: true, width:"10%", }, { name: "created_at", type: "text", title: "Sent On", formatter: "date", width:"10%", }, { type: "control", modeSwitchButton: false,editButton:false, deleteButton:false,} ] }); }); </script>fetch_data.php
$method = $_SERVER['REQUEST_METHOD'];
if($method == 'GET')
{
$data = array(
':first_name' => "%" . $_GET['first_name'] . "%",
':last_name' => "%" . $_GET['last_name'] . "%",
':client_phone' => "%" . $_GET['client_phone'] . "%",
':txtmessage' => "%" . $_GET['txtmessage'] . "%",
':direction' => "%" . $_GET['direction'] . "%",
':message_status' => "%" . $_GET['message_status'] . "%",
':created_at' => "%" . $_GET['created_at'] . "%",
);
$query = "select *,c.first_name,c.last_name,c.txtphone,p.project_name from crm_notifications as n left JOIN crm_clients as c ON c.client_id=n.client_id left JOIN crm_projects as p ON p.project_id=n.project_id WHERE c.first_name LIKE :first_name AND c.last_name LIKE :last_name AND n.client_phone LIKE :client_phone AND n.txtmessage LIKE :txtmessage AND n.direction LIKE :direction AND n.message_status LIKE :message_status AND n.created_at LIKE :created_at ORDER BY created_at DESC";
$statement = $connect->prepare($query);
$statement->execute($data);
$result = $statement->fetchAll();
foreach($result as $row)
{
if($row['message_status']=='Delivered'){
$ststusclass="text-success";
}
elseif($row['message_status']=='Failed' || $row['message_status']=='Invalid'){
$ststusclass="text-danger";
}
elseif ($row['message_status']=='Reply') {
$ststusclass="text-warning";
}
elseif ($row['message_status']=='Received') {
$ststusclass="text-primary";
}
else{
$ststusclass="";
}
$directionclass= ($row['direction']=='Incoming')?'text-warning':'text-success';
$direction= "".$row['direction']."";
$status = "".$row['message_status']."";
$output[] = array(
'first_name' => $row['first_name'],
'last_name' => $row['last_name'],
'client_phone' => $row['client_phone'],
'txtmessage' => $row['txtmessage'],
'direction' => $direction,
'message_status' => $status,
'created_at' => date("Y-m-d",strtotime($row['created_at'])),
);
}
//till here getting 4000 records but not proceeding with json encode
header("Content-Type: application/json");
echo json_encode($output);
}
'll return no data to jsgrid
The text was updated successfully, but these errors were encountered: