当前位置: 首页>>代码示例>>PHP>>正文


PHP UserDao::getUserHeadImgNameById方法代码示例

本文整理汇总了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;
 }
开发者ID:fuzhengwei,项目名称:php,代码行数:41,代码来源:PicDao.php

示例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;
 }
开发者ID:fuzhengwei,项目名称:php,代码行数:22,代码来源:CaseDao.php


注:本文中的UserDao::getUserHeadImgNameById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。