本文整理汇总了PHP中DbUtil::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP DbUtil::getConnection方法的具体用法?PHP DbUtil::getConnection怎么用?PHP DbUtil::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbUtil
的用法示例。
在下文中一共展示了DbUtil::getConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMailUsers
function getMailUsers()
{
$idAlbum = 1;
$sql = "SELECT al.key as albumkey, ur.id as srcid, ur.email as srcemail, concat(ur.firstname, \" \", ur.lastname) as srcfullname, j.uid, j.email, j.fullname, j.idstickers \n \t\tFROM user ur, (SELECT m.idalbum, d.iduser as srcuser, m.iduser as uid, concat(u.firstname, \" \", u.lastname) as fullname,\n\t\t\t\t\t\t\t\t\tu.email, group_concat(d.stickernumber ORDER BY d.stickernumber SEPARATOR ', ') as idstickers \n\t\t\t\t\t\t\t\tFROM missing m \n\t\t\t\t\t\t\t\tJOIN duplicate d on m.stickernumber = d.stickernumber\n\t\t\t\t\t\t\t\t\tand m.idalbum = d.idalbum and d.copy > 0 \n\t\t\t\t\t\t\t\tJOIN user u on u.id = m.iduser and u.id != d.iduser\n\t\t\t\t\t\t\t\tWHERE u.active=1\n\t\t\t\t\t\t\t\tGROUP BY m.iduser, d.iduser) as j\n\t\tJOIN album al on al.id=j.idalbum\n\t\tWHERE j.srcuser = ur.id and ur.active=1\n\t\t";
$connection = DbUtil::getConnection();
$sql_result = mysqli_query($connection, $sql);
$info = array();
while ($sql_row = mysqli_fetch_array($sql_result)) {
$srcId = $sql_row['srcid'];
$albumKey = $sql_row['albumkey'];
if (!isset($info[$srcId])) {
$info[$srcId] = array();
$info[$srcId]["email"] = $sql_row['srcemail'];
$info[$srcId]["fullname"] = $sql_row['srcfullname'];
}
if (!isset($info[$srcId]["albums"])) {
$info[$srcId]["albums"] = array();
}
if (!isset($info[$srcId]["albums"][$albumKey])) {
$info[$srcId]["albums"][$albumKey] = array();
}
$info[$srcId]["albums"][$albumKey]["key"] = $albumKey;
if (!isset($info[$srcId]["albums"][$albumKey]["neededBy"])) {
$info[$srcId]["albums"][$albumKey]["neededBy"] = array();
}
$info[$srcId]["albums"][$albumKey]["neededBy"][] = array('id' => $sql_row['uid'], 'name' => $sql_row['fullname'], 'stickers' => $sql_row['idstickers']);
$srcId = $sql_row['uid'];
if (!isset($info[$srcId])) {
$info[$srcId] = array();
$info[$srcId]["email"] = $sql_row['email'];
$info[$srcId]["fullname"] = $sql_row['fullname'];
}
if (!isset($info[$srcId]["albums"])) {
$info[$srcId]["albums"] = array();
}
if (!isset($info[$srcId]["albums"][$albumKey])) {
$info[$srcId]["albums"][$albumKey] = array();
$info[$srcId]["albums"][$albumKey]["key"] = $albumKey;
}
if (!isset($info[$srcId]["albums"][$albumKey]["hasStickers4You"])) {
$info[$srcId]["albums"][$albumKey]["hasStickers4You"] = array();
}
$info[$srcId]["albums"][$albumKey]["hasStickers4You"][] = array('id' => $sql_row['srcid'], 'name' => $sql_row['srcfullname'], 'stickers' => $sql_row['idstickers']);
}
return $info;
}