Welcome Guest, Not a member yet? Register   Sign In
How to use models?
#10

[eluser]zoran119[/eluser]
[quote author="Nalorin" date="1283939753"]In my implementation[/quote]

so does your model for a car say look like this:

Code:
class Car extends Model {

    var $car_id = 0;
    var $make   = '';
    var $model = '';
    var $cost = 0;

    function Car()
    {
        // this constructor is not really complete... demo purposes
        parent::Model();
    }
    
    function set_cost($cost)
    {
        $sql = 'update cat set cost = ' . $cost . ' where car_id = ' . $this->car_id;
        mysql_query($sql);
    }

or like this:

Code:
class Car extends Model {

    function Car()
    {
        parent::Model();
    }
    
    function set_cost($car_id, $cost)
    {
        $sql = 'update cat set cost = ' . $cost . ' where car_id = ' . $car_id;
        mysql_query($sql);
    }


Messages In This Thread
How to use models? - by El Forum - 09-07-2010, 03:33 AM
How to use models? - by El Forum - 09-07-2010, 07:17 AM
How to use models? - by El Forum - 09-07-2010, 07:51 AM
How to use models? - by El Forum - 09-07-2010, 07:52 AM
How to use models? - by El Forum - 09-07-2010, 07:59 AM
How to use models? - by El Forum - 09-07-2010, 10:34 AM
How to use models? - by El Forum - 09-07-2010, 05:15 PM
How to use models? - by El Forum - 09-07-2010, 05:16 PM
How to use models? - by El Forum - 09-07-2010, 10:55 PM
How to use models? - by El Forum - 09-08-2010, 02:46 AM
How to use models? - by El Forum - 09-08-2010, 02:55 AM
How to use models? - by El Forum - 09-08-2010, 07:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB