jamesxg1 Posted July 22, 2009 Share Posted July 22, 2009 Hiya, This is the print out im getting, Logged In As jamesxg1, With ID Array->id <?php class Command { private $dbusername; private $dbpassword; private $dbhost; private $dbbase; private $lusername; private $lpassword; function __construct($dbusername = "root", $dbpassword = "", $dbhost = "localhost", $dbbase = "sli", $lusername = "none", $lpassword = "none") { $this->dbusername = $dbusername; $this->dbpassword = $dbpassword; $this->dbhost = $dbhost; $this->dbbase = $dbbase; $this->lusername = $lusername; $this->lpassowrd = $lpassword; } function MYSQLConnection() { $this->MYSQLConnect = mysql_connect($this->dbhost, $this->dbusername, $this->dbpassword); $this->SelectDB = mysql_select_db($this->dbbase, $this->MYSQLConnect) or die(mysql_error()); return($this->SelectDB); } function Login($lusername, $lpassword) { session_start(); $this->lusername = mysql_real_escape_string($lusername); $this->lpassword = mysql_real_escape_string(md5($lpassword)); $this->LoginQ = "SELECT * FROM `members` WHERE username = '$this->lusername' AND password = '$this->lpassword'"; $this->LoginR = mysql_query($this->LoginQ) or die (mysql_error()); if(mysql_num_rows($this->LoginR) == '1') { $this->fetch = mysql_fetch_assoc($this->LoginR); if($this->fetch['sus'] == '0') { $_SESSION['username'] = $this->lusername; $_SESSION['id'] = $this->fetch['id']; echo "Logged In As $this->lusername, With ID $this->fetch->id"; } else { echo "Sorry but the account you are trying to access is suspended, Please try again."; } } else { echo "Sorry but the account you are trying to access is non existant, Please try again."; } } function Logout() { session_start(); session_unset(); session_destroy(); } } ?> im trying to make it so all i have to do is type $this->fetch & what ever i need fetched outputted what do i need to do ?, Many thanks, James. Link to comment https://forums.phpfreaks.com/topic/167006-solved-class-and-array-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.