本文整理汇总了PHP中AbstractController::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractController::getConnection方法的具体用法?PHP AbstractController::getConnection怎么用?PHP AbstractController::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractController
的用法示例。
在下文中一共展示了AbstractController::getConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
private function login($username, $password)
{
$connection = parent::getConnection();
$sql = "Select * from user where username = '" . mysqli_escape_string($connection, $username) . "' and password='" . mysqli_escape_string($connection, $password) . "'";
$sql_result = mysqli_query($connection, $sql) or exit("Sql Error" . mysqli_error($connection));
while ($sql_row = mysqli_fetch_array($sql_result)) {
$albumSql = "Select a.* from album a,albumuser au where a.id=au.idalbum and au.iduser=" . $sql_row['id'];
$sql_albumResult = mysqli_query($connection, $albumSql) or exit("Sql Error" . mysqli_error($connection));
$albums = array();
while ($sql_albumRow = mysqli_fetch_array($sql_albumResult)) {
$album = new Album($sql_albumRow['id'], $sql_albumRow['key'], $sql_albumRow['stickercount']);
$albums[$sql_albumRow['id']] = $album;
}
$user = new User($sql_row['id'], $sql_row['username'], $sql_row['firstname'], $sql_row['lastname'], $albums);
return $user;
}
return null;
}
示例2: getMatch
private function getMatch($albumId)
{
$connection = parent::getConnection();
$sql = "SELECT d.iduser as uid, concat(u.firstname, ' ', u.lastname) as fullname, group_concat(m.stickernumber SEPARATOR ',') as idstickers\n \t FROM missing m \n \t\t\t\t\tLEFT OUTER JOIN duplicate d ON \n \t\t\t\t\t\t\t\tm.stickernumber = d.stickernumber \n \t\t\t\t\t\tand m.idalbum = d.idalbum \n \t\t\t\t\t\tand m.idalbum = " . mysqli_escape_string($connection, $albumId) . " \n \t\t\t\t\t\tand d.copy > 0\n \t\t\t\t\t\tand d.iduser in (SELECT id from user where active=1)\n \t LEFT OUTER JOIN user u ON u.id = d.iduser\n \t\t\t\t\tWHERE m.iduser = " . $_SESSION['user']->getUserId() . "\n \t\t\t\t and m.idalbum = " . mysqli_escape_string($connection, $albumId) . " \n \t\t\t\t\tGROUP by d.iduser";
$sql_result = mysqli_query($connection, $sql) or exit("Sql Error" . mysqli_error($connection));
$pair = array();
while ($sql_row = mysqli_fetch_array($sql_result)) {
$pair['uid'] = $sql_row["uid"];
$pair['fullname'] = $sql_row["fullname"];
$pair['stickers'] = explode(",", $sql_row["idstickers"]);
$result[] = $pair;
}
$returnArray = array();
$returnArray['type'] = "match";
$returnArray['data'] = $result;
return $returnArray;
}
示例3: processInternal
function processInternal($urlRewrite)
{
$connection = parent::getConnection();
$allAlbums = $this->getAllAlbums($connection);
return array('render' => true, 'allAlbums' => $allAlbums);
}