Re: Proper OOP Syntax

From: Date: Tue, 21 Feb 2006 00:06:09 +0000
Subject: Re: Proper OOP Syntax
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-230776@lists.php.net to get a copy of this message
Thank you Chris. Albert On Feb 20, 2006, at 5:00 PM, Chris wrote:
Albert Padley wrote:
Given the following code: $password = (strlen($this->user_pw) < 32) ? md5($this->user_pw) : $this->user_pw;
            $sql = sprintf("SELECT COUNT(*) AS test, TeamID FROM %s WHERE  BINARY login = '%s' AND pw = '%s' AND active = 'y'", $this-  >table_name, $this->user, $password);
        }
        $result = mysql_query($sql) or die(mysql_error());
        if (mysql_result($result, 0, "test") == 1) {
            return true;
        } else {
            return false;
        }
How would I set a session variable for the value of TeamID?
You'll need to change it so you actually fetch the teamid: $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($result); if (empty($row)) { return false; } $_SESSION['TeamID'] = (int)$row['TeamID']; return true;


« previous php.general (#230776) next »