代码点火器更新无法立即在服务器上运行

时间:2012-11-22 06:15:44

标签: php codeigniter

我面临一个相当奇怪的问题..

我正在使用Code Igniter和MySQL在Yellowpages网站上工作。在我的本地机器上一切正常,但上传到我的服务器时遇到问题。

唯一的问题是:

当我更改某些更改并按更新按钮时,更改会立即显示在视图中(还检查它是否在数据库中获得更新)。但是,如果我在5-10秒内再次按下“编辑”按钮,则撤消更改。

最有趣的事实是,即使我按旧更改按更新...来几个小时检查。我再次看到了新的价值观。

我真的不知道什么是错的。

以下是我的代码:

控制器


    function customerList()
    {
        $data = array();
        $data = $this->footer_images();

        $this->load->library('pagination');

        if($this->session->userdata('user_role') == "Admin" || $this->session->userdata('user_role') == "Employee")
        {
            if($this->session->userdata('user_role') == "Admin")
                $cond = array('enabled' => 1,'approve' => 1);
            else if($this->session->userdata('user_role') == "Employee")
                $cond = array('enabled' => 1,'approve' => 1,'branch' => $this->session->userdata('branch'));

            $config = array();

            $config["base_url"] = base_url() . "home/customerList";
            $config["total_rows"] = $this->companies->count_entry($cond,"companies");
            $config["per_page"] = 10;
            $config["uri_segment"] = 3;
            $config["num_links"] = 3;
            $config["full_tag_open"] = '';
            $config["full_tag_close"] = '';
            $config["cond"]=$cond;

            $this->pagination->initialize($config);

            $off=$this->uri->segment(3);

            if($off=="" && !isset($_POST['off']))
                $off=0;
            else if(isset($_POST['off']))
                $off=$this->input->post("off");
            else
                $off=$this->uri->segment(3);

            $data["customers"] = $this->companies->get_data_with_cond_page($config["per_page"], $off, $config["cond"]); 


            $content_data['content'] = $this->load->view("customerList",$data,TRUE);

            if($this->session->userdata('user_role') == "Admin")
                $this->load->view('masterTemplate/adminTemplate',$content_data);                
            else if($this->session->userdata('user_role') == "Employee")
                $this->load->view('masterTemplate/employeeTemplate',$content_data);
        }
        else
        {
            $data['signup_error'] = "OK";
            $content_data['content'] = $this->load->view("home",$data,TRUE);
            $this->load->view("masterTemplate/template",$content_data);
        }
    }


    function editCompany()
    {

        $data = array();
        $data = $this->footer_images();

        $slno = $this->uri->segment(3);

        $cond = array('slno' => $slno);
        $data['results'] = $this->companies->get_data_with_cond($cond);
        $data['category'] = $this->category->get_all_data();
        //// $data['subcategory'] = $this->subcategories->get_all_data();

        /*  $data['makeColumns'] = $this->makeColumns1();
        $data['getTotalData'] = $this->getTotalData("category","");
        $data['perPage'] = $this->perPage(); */
        $data['category'] = $this->category->get_all_data();

        if($this->session->userdata('user_role') == "Admin")
        {
            $this->load->view('template/Admin/header');
            $this->load->view("edit_company",$data);
            $this->load->view('template/Admin/footer',$data);
        }

    }

    function updateCompany()
    {
        $this->form_validation->set_rules('company_name', 'Company Name', 'required');
        $this->form_validation->set_rules('category', 'Category', 'required');

        if ($this->form_validation->run() == FALSE)
        {
            $sl = $this->input->post('slno');
            redirect("home/editCompany/$sl?stat=err");          
        }
        else
        {
                $data = array(
                                'company_name' => $this->input->post('company_name'),
                                'contact_person' => $this->input->post('contact_person'),
                                'address' => $this->input->post('address'),
                                'city' => $this->input->post('city'),
                                'state' => $this->input->post('state'),
                                'landmarks' => $this->input->post('landmarks'),
                                'pincode' => $this->input->post('pincode'),
                                'std_code' => $this->input->post('std_code'),
                                'mobile' => $this->input->post('mobile'),
                                'phone' => $this->input->post('phone'),
                                'fax' => $this->input->post('fax'),
                                'cmail' => $this->input->post('cemail'),
                                'website' => $this->input->post('website'),
                                'category_name' => $this->input->post('category')
                            );

                $cond = array(
                            'slno' => $this->input->post('slno')
                         );




                        if($this->companies->update_data($cond,$data))
                        {
                            redirect("home/customerList?stat=ok");
                        }
                        else
                        {
                            redirect("home/customerList?stat=nok");
                        }

        }
    }

模型


    function update_data($cond,$data)
    {
        $this->db->where($cond)->update('companies',$data);
        return true;
    }

早期的帮助将得到真正的赞赏。谢谢! :)

2 个答案:

答案 0 :(得分:0)

尝试按下control + f5以在更新后刷新缓存

答案 1 :(得分:0)

看起来我的页面缓存有问题。一旦我使用了无缓存公式......我现在工作,运行良好。