Results 1 to 1 of 1

Thread: Background refreshing a controller from another page PHP(codeigniter)+Ajax

  1. #1
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Background refreshing a controller from another page PHP(codeigniter)+Ajax

    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'], 02);
            
    $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
    Last edited by Beverleyh; 04-29-2014 at 07:32 AM. Reason: formatting

Similar Threads

  1. Refreshing posts of a forum via ajax?
    By Vernier in forum JavaScript
    Replies: 3
    Last Post: 08-15-2012, 11:17 AM
  2. Refreshing Multiple Divs Ajax HELP!
    By paulupnorth in forum JavaScript
    Replies: 1
    Last Post: 07-13-2012, 04:45 PM
  3. Replies: 4
    Last Post: 01-17-2007, 02:22 PM
  4. Dynamic Ajax Content not refreshing in IE
    By jeff in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 03-08-2006, 11:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •