本文整理汇总了PHP中Dal::row_object方法的典型用法代码示例。如果您正苦于以下问题:PHP Dal::row_object方法的具体用法?PHP Dal::row_object怎么用?PHP Dal::row_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dal
的用法示例。
在下文中一共展示了Dal::row_object方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query_one_object
public static function query_one_object($sql, $args = NULL)
{
$sth = Dal::query($sql, $args);
$ret = Dal::row_object($sth);
return $ret;
}
示例2: get_user_role
/**
* Purpose: this function gets user role based on user id
* user id should be set
* @return array of the role 1 record
*/
public static function get_user_role($user_id)
{
Logger::log("Enter: function Roles::get_user_role");
if (empty($user_id)) {
throw new PAException(REQUIRED_PARAMETERS_MISSING, "User id is not set.");
}
$res = Dal::query(' SELECT role_id FROM {users_adminroles} WHERE user_id = ?', array($user_id));
$r = Dal::row_object($res);
Logger::log("Exit: function Roles:get_user_role");
return $r;
}
示例3: get_role_name
/**
* Purpose: this function returns role name based on $role_id argument
* @return string role name
*/
public static function get_role_name($role_id)
{
Logger::log("Enter: function Roles::get_role_name");
if (empty($role_id)) {
throw new CNException(REQUIRED_PARAMETERS_MISSING, "Role id is not set.");
}
$res = Dal::query(' SELECT name FROM {roles} WHERE id = ?', array($role_id));
$r = Dal::row_object($res);
$name = $r ? $r->name : null;
Logger::log("Exit: function Roles:get_role_name");
return $name;
}