PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
class privilege {
public function __construct(){
}
function p($app) {
// run SQL to get privileges for $app
// hard coding the privileges for now
$type = array("Read"=> "R", "Write"=> "W", "Update"=> "U", "Delete"=> "D");
return $type;
}
}
$privilege = new privileges();
$privilege->p(APP_NAME);
// this is how I'd like to use the array items
echo $privilege->type['read'];
echo $privilege->type['write'];
echo $privilege->type['update'];
echo $privilege->type['delete'];
I'm getting an error:
Undefined property: privileges::$type
Last edited by dimxasnewfrozen on Wed Jun 02, 2010 4:15 pm, edited 1 time in total.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.