I'm facing a rather strange problem with this..
I'm working on a Yellowpages website using Code Igniter and MySQL. Everything works fine on my local machine, but I face a problem when uploaded to my server.
The only problem being:
When I make change some changes and press the update button, the changes are immediately shown in the view (Have also checked that it gets updates in the Database). However, if I press the 'Edit' button again within say 5-10 seconds the changes are undone.
The most interesting fact being, even if I press update with the old changes...come and check in a few hours. I see the new values again.
I really don't know whats wrong.
Here are my codes :
Controller
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"); } } }
Model
function update_data($cond,$data) { $this->db->where($cond)->update('companies',$data); return true; }
An early help will be truly appreciated. Thanks! :)