File: /home/cafsindia/login_cafsindia_com/application/controllers/Special_campaign.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Special_campaign extends Action_controller{
public function __construct(){
parent::__construct('special_campaign');
$this->collect_base_info();
}
// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
public function index(){
$this->load->view("$this->control_name/manage",$data);
}
// MOBILE NUMBER GET THE VALUE WITH TABLE
public function special_campaign(){
$mobile_number = $this->input->post('mobile_number', TRUE); // TRUE enables XSS filtering
if(empty($mobile_number)){
echo json_encode(['success' => FALSE, 'message' => 'Mobile number is required']);
return;
}
$spl_data_qry = 'SELECT * FROM cw_special_data WHERE mobile_number = "'.$mobile_number.'"';
$spl_data = $this->db->query("CALL sp_a_run('SELECT', '$spl_data_qry')");
$spl_data_result = $spl_data->result();
$spl_data->next_result(); // Advance to the next result set
$status = false;
$tr_line = '';
$no = 1;
if($spl_data_result){
$status = true;
foreach($spl_data_result as $data){
$data->remarks = str_replace("~",'"',$data->remarks);
$data->remarks = str_replace("^",'&',$data->remarks);
$data->remarks = str_replace("`","'",$data->remarks);
$tr_line .= '<tr class = div_cards>
<td><span>'.$no.'</span></td>
<td><span>'.$data->customer_name.'</span></td>
<td><span>'.$data->mobile_number.'</span></td>
<td style="word-break: break-word;"><span>'.$data->remarks.'</span></td>
</tr>';
$no ++;
}
}else{
$tr_line .= '<tr class="div_cards"><td style="text-align:center;">No Data found</td></tr>';
}
$html_content = '<table class="table table-striped table-bordered"style="width:100% !important">
<tr>
<td><span id = "header">S.NO</span></td>
<td><span id = "header">CUSTOMER NAME</span></td>
<td><span id = "header">MOBILE NUMBER</span></td>
<td><span id = "header">REMARKS</span></td>
</tr>
<tbody>'.$tr_line.'</tbody>
</table>';
if($status){
echo json_encode(['success' => true,'response_data' => $html_content]);
}else{
echo json_encode(['success' => false,'response_data' => $html_content]);
}
}
}
?>