1

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

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

唯一的问题是:

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

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

我真的不知道怎么了。

这是我的代码:

控制器

    功能客户列表()
    {
        $数据 = 数组();
        $data = $this->footer_images();

        $this->load->library('分页');

        if($this->session->userdata('user_role') == "Admin" || $this->session->userdata('user_role') == "Employee")
        {
            if($this->session->userdata('user_role') == "Admin")
                $cond = array('启用' => 1,'批准' => 1);
            否则 if($this->session->userdata('user_role') == "Employee")
                $cond = array('enabled' => 1,'approve' => 1,'branch' => $this->session->userdata('branch'));

            $config = 数组();

            $config["base_url"] = base_url() 。“家/客户名单”;
            $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->分页->初始化($config);

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

            if($off=="" && !isset($_POST['off']))
                $off=0;
            否则 if(isset($_POST['off']))
                $off=$this->input->post("off");
            别的
                $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);                
            否则 if($this->session->userdata('user_role') == "Employee")
                $this->load->view('masterTemplate/employeeTemplate',$content_data);
        }
        别的
        {
            $data['signup_error'] = "OK";
            $content_data['content'] = $this->load->view("home",$data,TRUE);
            $this->load->view("masterTemplate/template",$content_data);
        }
    }


    函数编辑公司()
    {

        $数据 = 数组();
        $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);
        }

    }

    函数更新公司()
    {
        $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');
            重定向(“home/editCompany/$sl?stat=err”);          
        }
        别的
        {
                $数据 = 数组(
                                'company_name' => $this->input->post('company_name'),
                                'contact_person' => $this->input->post('contact_person'),
                                '地址' => $this->input->post('地址'),
                                'city' => $this->input->post('city'),
                                'state' => $this->input->post('state'),
                                '地标' => $this->input->post('地标'),
                                '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'),
                                '网站' => $this->input->post('网站'),
                                'category_name' => $this->input->post('category')
                            );

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




                        if($this->companies->update_data($cond,$data))
                        {
                            重定向(“home/customerList?stat=ok”);
                        }
                        别的
                        {
                            重定向(“home/customerList?stat=nok”);
                        }

        }
    }

模型

    函数更新数据($cond,$data)
    {
        $this->db->where($cond)->update('companies',$data);
        返回真;
    }

早期的帮助将不胜感激。谢谢!:)

4

2 回答 2

1

看来我的页面缓存有问题。一旦我使用了无缓存公式……它就起作用了。现在,跑得也不错。

于 2012-12-10T10:01:29.090 回答
0

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

于 2012-11-22T06:20:27.583 回答