本文整理匯總了PHP中UserDao::getUserHeadImgNameById方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserDao::getUserHeadImgNameById方法的具體用法?PHP UserDao::getUserHeadImgNameById怎麽用?PHP UserDao::getUserHeadImgNameById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserDao
的用法示例。
在下文中一共展示了UserDao::getUserHeadImgNameById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPicList
public function getPicList($page, $pic_type)
{
//引入數據庫連接
require_once '../../conndb/mysql/ConnMysqlClass.php';
require_once '../../user/dao/UserDao.php';
//定義每頁的條數
$pageCount = 10;
//如果是0頁或者沒有賦值那麽默認給第一頁
if ("" == $page || 0 == $page) {
$page = 1;
}
//分頁數據
$page_start = ($page - 1) * $pageCount;
//獲取數據庫鏈接
$conn = ConnMysqlClass::getConnMysql();
mysql_select_db(ConnMysqlClass::getDBName(), $conn);
$str_sql = "select pic_id,fk_user_id,pic_name,pic_type,pic_highlight,pic_width,pic_height,pic_size,pic_up_data,pic_statue from stack_resource_pic ";
//分頁查詢【數量】
$str_sql_count = "select count(pic_id) from stack_resource_pic ";
if ("" != $pic_type) {
$str_sql .= "where pic_type = '{$pic_type}' ";
$str_sql_count .= "where pic_type = '{$pic_type}' ";
}
$str_sql .= "order by pic_id desc limit {$page_start},{$pageCount}";
$result = mysql_query($str_sql);
$arrPics = array();
$var = 0;
//根據用戶id查詢用戶名
$userDao = new UserDao();
while ($row = mysql_fetch_array($result)) {
$arrPics[$var++] = array("pic_id" => $row['pic_id'], "fk_user_id" => $row['fk_user_id'], 'user_head_img_name' => $userDao->getUserHeadImgNameById($row['fk_user_id']), 'user_name' => $userDao->getUserById($row['fk_user_id']), "pic_name" => $row['pic_name'], "pic_type" => $row["pic_type"], "pic_highlight" => $row['pic_highlight'], "pic_width" => $row['pic_width'], "pic_height" => $row['pic_height'], "pic_size" => $row['pic_size'], "pic_up_data" => $row['pic_up_data'], "pic_statue" => $row['pic_statue']);
}
//查詢數量能分出來多少頁
$result = mysql_query($str_sql_count);
$row = mysql_fetch_array($result);
//獲得分頁
$pageNum = ceil($row[0] / $pageCount);
$arrPics['pageSum'] = strval($pageNum);
mysql_close($conn);
return $arrPics;
}
示例2: getCaseDiscussListById
/**
* 根據id獲得評論表
*
* @param 案例id $resource_case_id
*/
public function getCaseDiscussListById($resource_case_id)
{
require_once '../../conndb/mysql/ConnMysqlClass.php';
require_once '../../user/dao/UserDao.php';
//根據用戶id查詢用戶名
$userDao = new UserDao();
$conn = ConnMysqlClass::getConnMysql();
mysql_select_db(ConnMysqlClass::getDBName(), $conn);
$sql = "select * from stack_resource_case_discuss where fk_resource_case_id = {$resource_case_id} order by resource_case_discuss_data desc";
$result = mysql_query($sql);
$arrDiscussList = array();
$var = 0;
while ($row = mysql_fetch_array($result)) {
$arrDiscussList[$var++] = array('resource_case_discuss_id' => $row['resource_case_discuss_id'], 'fk_user_id' => $row['fk_user_id'], 'user_name' => $userDao->getUserById($row['fk_user_id']), 'user_head_img_name' => $userDao->getUserHeadImgNameById($row['fk_user_id']), 'fk_resource_case_id' => $row['fk_resource_case_id'], 'resource_case_discuss_data' => $row['resource_case_discuss_data'], 'resource_case_discuss_content' => $row['resource_case_discuss_content']);
}
return $arrDiscussList;
}