Posts

Showing posts from March, 2021

image fetch in codginater and join nd order_by

View ==>fetch <td><img width="90" height="50" src="../images/image_upload/'.$value['image_path'].'"></td> MODELS==> JOIN ND ORDER BY 1..$this->db->join('country','country.id=form.country','Left');//2tables data fetch in 1 page 2..$this->db->order_by("id ", "desc");

Add Contury with Code

 VIEW==>  <p><label>Country</label>  <select name="country">                                              <?php           foreach ($formdata as $value) {    echo '<option>'.$value['id'].$value['country'].'</option>'; } ?> </select> </p>       

Model all Querys

INSERT==> function form($data) { $insert = $this->db->insert('form', $data); }   UPDATE==> function update($id, $data)     { $this->db->where('id', $id); $this->db->update('form', $data);                 $error = $this->db->error();                 if(empty($error['message'])) { return true; }                 else { return false; } } FETCH==> public function fetch_data(){ $this->db->select('*'); $this->db->from('form'); $query = $this->db->get(); return $query->result_array(); } DELETE==> public function del ($id  { $this->db->where('id',$id); $insert = $this->db->delete('form'); return true; }

Importent Notes

 1. URI Segment Using CodeIgniter URL class’s function, we can retrieve information from URI string. In this tutorial we are going to explain how we can use the URI class in CodeIgniter to retrieve information from URI segment. uri segment url se data get krane k lie use hota hai indexing URL ke function ke indexing ke according specific data get karne ke lie use hota hai .. 2.&nbsp =in use space 3. flash data . kuch time k lie data store karta hai session mai 4.database se same data se jo register hai usse login k lie hum count     krenge for example  if(count($valid)>0)  isme condition hai if k sath hai ki agr count $vaild mai jo data hai vo 0 se bada hai. 5. explode function= sting ko aaray mai convert ke lie use hota hai 6. implode function =array ko string mai convert karta hai 6. is_numeric function = Finds whether a variable is a number or a numeric string(ye varuable mai dekta hai ki value number ya numaric hai ya nahi if(is_numeric($order_id)){  $this->session->s

Login( after regester for data in codginetar with session);

controler====>  public function login_form(){ $data['page_keywords'] = ''; $data['page_description'] = ''; $data['page_slug'] = 'business_plan'; $data['page_title'] = 'Business Plan'; if($this->session->userdata('is_customer_logged_in')){ redirect(base_url().'index.php/home_page'); } // print_r($this->session->userdata()); die(); if ($this->input->server('REQUEST_METHOD') === 'POST') { $this->form_validation->set_rules('email','email','required'); $this->form_validation->set_rules('password', 'password', 'required'); $email = $this->input->post('email'); $password =$this->input->post('password'); $valid = $this->customer_model->login_form($email,$passw

Data Fetch and Update with codginater

controller   public function update() { $user_id = $this->uri->segment(2); $result = $this->customer_model->get_single_user_detail($user_id); $data['page_keywords'] = ''; $data['page_description'] = ''; $data['page_slug'] = 'not-found'; $data['page_title'] = 'Not Found'; if ($this->input->server('REQUEST_METHOD') === 'POST') { $data['formdata'] = $this->customer_model->fetch_data(); //form validation $this->form_validation->set_rules('name', 'name', 'required'); $this->form_validation->set_rules('name', 'name', 'required'); $this->form_validation->set_rules('phonenub', 'Mobile', 'required|min_length[10]|max_length[10]'); $this->form_validation->

Insert data And Image upload with codginater

  controler page ======> public function form() if(isset($_FILES["signature"]["name"]) && empty($_FILES["signature"]["name"])){ $this->session->set_flashdata('error','Please upload signature file .'); redirect($this->agent->referrer()); } if(isset($_FILES["logo"]["name"]) && empty($_FILES["logo"]["name"])){ $this->session->set_flashdata('error','Please upload logo file .'); redirect($this->agent->referrer()); } //define upload folder name $signature_file_uplad_dir ="uploads/signature/"; //get upload file name $signature_file_name =time().basename($_FILES["signature"]["name"]); //file upload path $signature_target_file_upload =$this->system_dir.$signature_file_uplad_dir.$signature_file_name; //get file upload path $signature_file_upload_url =$si