Welcome Guest, Not a member yet? Register   Sign In
Call functions in to model..
#7

[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);
  }

}
?>


Messages In This Thread
Call functions in to model.. - by El Forum - 05-02-2009, 08:09 PM
Call functions in to model.. - by El Forum - 05-03-2009, 01:56 AM
Call functions in to model.. - by El Forum - 05-03-2009, 03:55 AM
Call functions in to model.. - by El Forum - 05-03-2009, 09:13 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:06 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:23 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:25 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:27 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:31 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:48 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:59 AM
Call functions in to model.. - by El Forum - 05-03-2009, 12:26 PM
Call functions in to model.. - by El Forum - 05-04-2009, 08:05 AM
Call functions in to model.. - by El Forum - 05-04-2009, 08:38 AM
Call functions in to model.. - by El Forum - 05-04-2009, 10:10 AM
Call functions in to model.. - by El Forum - 05-04-2009, 05:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB