Welcome Guest, Not a member yet? Register   Sign In
Model library
#8

[eluser]hugle[/eluser]
[quote author="waldmeister" date="1254749400"]Wouldn't it be easier to adjust your model slightly? Wink
E.g. by adding another attribute:
Code:
class MY_Model extends Model {

    var $table = "";
    var $primary_key = "id";
and using that attribute in your methods instead of 'id'?[/quote]

good point waldmeister Smile)

your examples are everywhere Smile

I just wanted to ask, how do I pass the $table value to that model?

If I do for example ....

model:
Code:
class Book extends MY_Model {

    function Book()
    {
        parent::MY_Model();
    }

and the controller:

Code:
$this->load->model('book');

$book = array();
$book['title'] = 'The Man';
$book['author'] = 'Unknown';

$this->book->insert($book);

But as I said, I need to specify $table and por example $primary_key in model, so it updates/inserts/finds in different tables...

how is that done? I think that should be done in Model...

thanks !


Messages In This Thread
Model library - by El Forum - 10-04-2009, 10:43 PM
Model library - by El Forum - 10-05-2009, 12:50 AM
Model library - by El Forum - 10-05-2009, 12:52 AM
Model library - by El Forum - 10-05-2009, 01:48 AM
Model library - by El Forum - 10-05-2009, 02:14 AM
Model library - by El Forum - 10-05-2009, 02:24 AM
Model library - by El Forum - 10-05-2009, 02:30 AM
Model library - by El Forum - 10-05-2009, 04:18 AM
Model library - by El Forum - 10-05-2009, 04:33 AM
Model library - by El Forum - 10-05-2009, 04:58 AM
Model library - by El Forum - 10-05-2009, 02:57 PM
Model library - by El Forum - 10-05-2009, 11:34 PM
Model library - by El Forum - 12-29-2009, 09:16 AM
Model library - by El Forum - 12-29-2009, 07:28 PM
Model library - by El Forum - 12-29-2009, 08:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB