note 39058 added to language.oop
| From: | AndrewEddy at rn2 dot php dot net | Date: | Thu, 15 Jan 2004 16:05:48 +0000 |
| Subject: | note 39058 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63629@lists.php.net to get a copy of this message | ||
A quick note, Here's an example of a class I made that used a function to pass back a value to
a variable, it happens to be an array but you can use ints and strings just as well
<?
class tadmin{
var $access;
var $user_id;
function tadmin()
{
$this->access = $this->get_access();
$this->user_id = $_SESSION['id'];
}
function get_access()
{
$sql = "SELECT permissions FROM users WHERE id = $this->user_id LIMIT 1";
$result = mysql_query($sql) or die("Can not get permissions");
$row = mysql_fetch_object($result);
$this->access = preg_split("/ /", $row->permissions);
return $this->access;
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/language.oop.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39058
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39058&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39058&report=yes
Search -- http://master.php.net/manage/user-notes.php