Welcome Guest, Not a member yet? Register   Sign In
Need desperate help! T_OBJECT_OPERATOR problem...
#1

[eluser]SparkyCola[/eluser]
Hi, I keep getting the T_OBJECT_OPERATOR message for the following line of code:

$row = query->row_array();

I know it is that one because it works without it, (but ends up with a "variable $row undefined" message) and that's the line being referenced in the error. Does anyone have any clue as to why it doesn't like that line? Please help, got a deadline tomorrow morning :S

Here is the line in context, it's in a callback validation method, commented to help you understand what is happening...

Code:
// if name has forbidden characters in display error
if (ereg($pattern,$name_input)) {
    $this->validation->set_message('_check_edit_name', 'Please use valid characters in the name field. ');
    return FALSE;
} else {
    //return the row in the database of the name supplied
    $query = $this->staff_model->nameQuery($name_input);        
    //the offending line:
    $row = query->row_array();
    //if there's no one of that name already, or the name is the same as the one given, return true
    //(this is in edit, they are allowed to keep the name the same as it was originally,      
    //but other than that it must be unique in the db)
    if (($query->num_rows() == 0) || ($row['name'] == $name_input) ) {
        return TRUE;
    } else {
        $this->validation->set_message('_check_edit_name', 'That name already exists in the database. Please choose another.');
        return FALSE;
    }
}

Please help! Also, because the client is using PHP4, we have to, to. We don't have any choice so please don't criticise for it - we HAVE to make it so the client can actually use it. Thanks in advance,

Sparky
#2

[eluser]SparkyCola[/eluser]
Wait, nevermind...think I've got it *blush* stupid mistake... it's meant to be:

$row = $query->row_array();

right? Sorry for wasting your time *is embarrassed*

Sparky




Theme © iAndrew 2016 - Forum software by © MyBB