Welcome Guest, Not a member yet? Register   Sign In
Active Record delete not working
#1

[eluser]Brad K Morse[/eluser]
Code:
<?php
//this works
$sql = 'DELETE FROM '.$crudTableName.' WHERE '.$k.' = '.$crudColumnValues['id'];
$this->db->query($sql);

// shortened it up to be this, but it does not work, am I missing something?    
$this->db->delete($crudTableName, array($k => $crudColumnValues['id']));
?>

it does not output any error codes, it just does not delete anything.
#2

[eluser]SitesByJoe[/eluser]
Have you tried the old fashioned:

Code:
$this->db->where($k = %crudColumnValues['id'];
$this->db->delete($crudTableName);

It might work, but I've never used the 2nd argument in an Active Record delete statement...
#3

[eluser]Brad K Morse[/eluser]
That did not work. I added the ) to the end of the first line and replaced the % with $, I am not sure if that was a typo or not.
#4

[eluser]toopay[/eluser]
Code:
$this->db->delete($crudTableName, array($k => $crudColumnValues['id']));

I had several function which similar to that, but it works. Are you sure that $crudColumnValues['id'] contain some value? it should work.




Theme © iAndrew 2016 - Forum software by © MyBB