mysql question #2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, I read the php.net info. so with this function though:

	public function select_one($sql) {
		$this->last_query = $sql;
		$r = mysql_query($sql);
		if (!$r) {
			$this->last_error = mysql_error();
			return false;
		}
		if (mysql_num_rows($r) != 1) {
			return false;  	
		}
		$ret = mysql_result($r, 0);
		mysql_free_result($r);
		if ($this->auto_slashes) {
			return stripslashes($ret);
		} else {
			return $ret;
		}
	}


how can i get the contents of a column in the returned row say for something called "Email" as the column name. here is my code now:

    // Attempt to login a user
	public function CheckValidUser($Email, $Password) {
		$PasswordEncoded = $this->encode($Password);
$sql = "SELECT * FROM CMS_Users WHERE Email='$Email' AND Password='$PasswordEncoded'";
		$result = $this->DB->select_one($sql);
		if ($result) {
			// User info stored in Sessions
			$_SESSION['Status'] = "loggedIn";
			$_SESSION['ID'] = $row['ID'];
			$_SESSION['Email'] = $row['Email'];
			$_SESSION['AdminLevel'] = $row['AdminLevel'];
			$_SESSION['FirstName'] = $row['FirstName'];
			$_SESSION['LastName'] = $row['LastName'];
			return true;
		} else {
			return false;
		}
	}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux