Welcome Guest, Not a member yet? Register   Sign In
T_OBJECT_OPERATOR syntax error
#4

[eluser]CheekyGeek[/eluser]
I'm stuck again, this time with another
Code:
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /Library/WebServer/Documents/CI/system/application/models/users_model.php on line 9

Here is the model - what in the world is the problem with line 9?

Code:
<?php

class Users_model extends Model
{

    var $user_id     = '';
    var $username     = '';
    var $password    = '';
    var $last_name    = '';
    var $first_name = '';    
    var $phone        = '';    
    var $email        = '';    
    var $org         = '';    
    var $admin        = '';    

    function Users_model() {

        // All models need to call the constructor of the parent Model class
        parent::Model();

    }



    function get() {

        // BEGIN FILTER CRITERIA CHECK
        // If any of the following properties are set before users_model->get() is called from the controller then we will include
        // a where statement for each of the properties that have been set.
        if ($this->user_id) {
            $this->db->where("user_id", $this->user_id);
        }

        if ($this->username) {
            $this->db->where("username", $this->username);
        }

        if ($this->password) {
            $this->db->where("password", $this->password);
        }

        if ($this->last_name) {
            $this->db->where("last_name", $this->last_name);
        }

        if ($this->first_name) {
            $this->db->where("first_name", $this->first_name);
        }

        if ($this->phone) {
            $this->db->where("phone", $this->phone);
        }

        if ($this->email) {
            $this->db->where("email", $this->email);
        }

        if ($this->org) {
            $this->db->where("org", $this->org);
        }

        if ($this->admin) {
            $this->db->where("admin", $this->admin);
        }
        // END FILTER CRITERIA CHECK

        // We will display our results in order by last name and then first name.
        $this->db->orderby("last_name, first_name");

        // This will execute the query and collect the results and other properties of the query into an object.
        $query = $this->db->get("users");

        // If you set users->user_id from your controller, then there will only be one row to return.
        if ($this->user_id) {
            return ($query->row());
        }

        // If mdl_users->users_id was not specified in the controller, then we will return the results as a result set.
        else {
            return ($query->result());
        }

    }

    function save() {

        // When we insert or update a record in CodeIgniter, we pass the results as an array:
        $db_array = array(
        "user_id" => $this->user_id,
        "username" => $this->username,
        "password" => $this->password,
        "last_name" => $this->last_name,
        "first_name" => $this->first_name,
        "phone" => $this->phone,
        "email" => $this->email,
        "org" => $this->org,
        "admin" => $this->admin);

        // If mdl_users->contact_id was set in the controller, then we will update an existing record.
        if ($this->users_id) {
            $this->db->where("users_id", $this->users_id);
            $this->db->update("users", $db_array);
        }

        // If mdl_users->users_id was not set in the controller, then we will insert a new record.
        else {
            $this->db->insert("users", $db_array);
        }

    }

    function delete() {

        // As long as mdl_contacts->contact_id was set in the controller, we will delete the record.
        if ($this->users_id) {
            $this->db->where("users_id", $this->users_id);
            $this->db->delete("users");
        }

    }

}
?>


Messages In This Thread
T_OBJECT_OPERATOR syntax error - by El Forum - 06-23-2008, 06:56 PM
T_OBJECT_OPERATOR syntax error - by El Forum - 06-23-2008, 07:11 PM
T_OBJECT_OPERATOR syntax error - by El Forum - 06-23-2008, 07:41 PM
T_OBJECT_OPERATOR syntax error - by El Forum - 06-23-2008, 08:21 PM
T_OBJECT_OPERATOR syntax error - by El Forum - 06-23-2008, 09:21 PM
T_OBJECT_OPERATOR syntax error - by El Forum - 06-24-2008, 07:00 AM
T_OBJECT_OPERATOR syntax error - by El Forum - 05-12-2012, 06:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB