• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI Segment Question

I am curious as to why this no longer works for me. It worked when I first built my application where there was very little data, now however I have over 25000 records so am wondering if I need an alternative.

This function should delete the record from the database based on the ID that is passed through. Here is my code:

public function deleteLead() {
  if($this->session->userdata('logged_in', TRUE))
   // Grab Lead Type ID
   $lead_id = $this->uri->segment(3, 0);
   $this->db->delete('lead_details', array('lead_id' => $lead_id));
   // Redirect
   redirect('leads/showAll', 'refresh');


did you change you database privileges?

it's not as simple as the ID no longer being in segment 3?

Guess its the thing that Ckirk mentioned, you can try var_dumping $this->uri->segments in the begining of your function to see exactly what you get.

However if this snippet is not somewhere in admin panel or somewhere hidden from public users, or you are not doing a check if user is owner of the record its really a bad practice to delete by url params, someone can delete your database Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.