Welcome Guest, Not a member yet? Register   Sign In
eh don't worry about it
#1

[eluser]pdxbenjamin[/eluser]
I have a few database tables for my users and on occasion the delete will fail because at times not all the tables have data for that user. How do I structure a delete statement to fail gracefully, and not worry about finding a matching row?

* I'm in the process of cleaning up the validator so fields can't be empty, but for now I need to clean up the old data. *

I just run a bunch of these in a function...
Quote:$did = $this->input->post('did');
$this->db->where('did', $did);
$this->db->delete('address');

$this->db->where('did', $did);
$this->db->delete('work_histor');



Thanks
#2

[eluser]solid9[/eluser]
check if the table is not empty.
before deleting...




Theme © iAndrew 2016 - Forum software by © MyBB