[eluser]Yorick Peterse[/eluser]
[quote author="Dr. Seuss" date="1241388387"]Yorick's post is almost your answer (I once had the same question). You use the "$this->functionname()" to call a function from a function that is defined WITHIN the same model / class.
<?php
MODEL
FUNCTION A {
$this->FUNCTION C
delete * table b
}
FUNCTION B {
$this->FUNCTION C
delete * table a
}
FUNCTION C {
insert into table a field a, b. parametres -> post xxxxx
}
?>[/quote]
I still don't quite get what he wants, as far as I can read he now wants to use the same function for multiple tasks, if so you could do the following:
Code:
<?php
function foo($param,$type) {
if($type == 'insert') {
$this->db->insert($param);
}
if($type == 'delete') {
$this->db->delete($param);
}
}
?>