I want to refresh acontroller from another php page after specific intervals. The refresh will be a background process. End user never know there is a refresh from this page to another page.
I mean to say I want to refresh a specific page ('htdocs/exampleproject/controller/site.php') when user enter in to the htdocs/exampleproject/anypage.php. this all should be done in background i m working on localhost.. windows 7... basically my controller is checking whether there is any entry in a database table from Gsm module... if any then do some work on it...so i want to refresh this controller after every 4to 5 minutes
here is my controller
PHP Code:
class Mydb_Controller extends CI_Controller {
public static $sender, $rep, $message, $bg, $loc;
function index() {
$this->load->model('mydb_model');
$data['result'] = $this->mydb_model->insertData();
$data['bcresult'] = $this->mydb_model->getData();
foreach ($data['bcresult'] as $row) {
$GLOBALS['sender'] = $row->sender;
$GLOBALS['message'] = $row->msg;
}
if ($GLOBALS['message'] == 'yes') {
$data['bcReply'] = $this->mydb_model->getReply();
foreach ($data['bcReply'] as $row) {
$this->db->query("INSERT INTO `request_reply`(`sender`, `msg`, `r_id`, `requestee`, `reciever`, `msg`, `status`) VALUES ('" . $row->sender . "','" . $row->msg . "','" . $row->id . "','" . $row->requestee . "','" . $row->reciever . "','" . $row->msg . "','" . $row->status . "')");
$this->db->query("INSERT INTO `dummy_out`(`requestee`, `reciever`, `blood_msg`, `status`) VALUES ('" . $row->requestee . "','" . $row->requestee . "','he is wiling to give.." . $row->reciever . "','send')");
}
} else {
//echo $GLOBALS['sender'];
$GLOBALS['bg'] = substr($GLOBALS['message'], 0, 2);
$GLOBALS['loc'] = substr($GLOBALS['message'], 3, (strlen($GLOBALS['message']) - 1));
$data['crresult'] = $this->mydb_model->bloodCall();
foreach ($data['crresult'] as $row) {
$this->db->query("INSERT INTO `dummy_out`(`requestee`, `reciever`, `msg`, `status`) VALUES ((SELECT sender FROM call ORDER BY id DESC LIMIT 1),'" . $row->cell_no . "','fgh','send')");
echo'done';
}
}
}
}
i want to refresh this controller after every 4 minutes in back ground
Bookmarks