本文整理匯總了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;
}