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


PHP DBConnection::executeSQLSelect方法代码示例

本文整理汇总了PHP中DBConnection::executeSQLSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::executeSQLSelect方法的具体用法?PHP DBConnection::executeSQLSelect怎么用?PHP DBConnection::executeSQLSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBConnection的用法示例。


在下文中一共展示了DBConnection::executeSQLSelect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: announcement

 /**
 	$afterDateTime: The earliest date/time that the announcement(s) was created; null if no restriction
 	$maxNumAnnouncements: The maximum number of announcements to return; null if no limit;
 	$userID: The id of the user who created the announcement(s); null if no restriction
 */
 public static function retrieveAnnouncements($afterDateTime = null, $maxNumAnnouncements = null, $userID = null)
 {
     $result = buildRetrieveSQL($afterDateTime, $maxNumAnnouncements, $userID);
     $strSQL = $result[0];
     $parameters = $result[1];
     $statement = DBConnection::executeSQLSelect($strSQL, $parameters);
     $announcements = array();
     $i = 0;
     while ($row = $statement->fetch()) {
         $announcements[$i++] = self::convertRowToAnnouncement($row);
     }
     return $announcements;
 }
开发者ID:laiello,项目名称:gtlolwebsite,代码行数:18,代码来源:AnnouncementsRepository.class.php

示例2: retrieveUserWhere

 /**
 	$where = 'WHERE [column_name]=:value'
 	$value = what should replace ':value' in $where
 	returns a User if the user is found or null otherwise
 */
 private static function retrieveUserWhere($where, $value)
 {
     $connection = DBConnection::getConnection();
     $sql = "SELECT id, username, password, name FROM Users WHERE {$where}";
     $parameters[':value'] = $value;
     $statement = DBConnection::executeSQLSelect($sql, $parameters);
     $result = $statement->fetch();
     if ($result === null) {
         return null;
     } else {
         $user = new User($result['id'], $result['username'], $result['password'], $result['name']);
         return $user;
     }
 }
开发者ID:laiello,项目名称:gtlolwebsite,代码行数:19,代码来源:UserRepository.class.php


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