當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DbUtil::getConnection方法代碼示例

本文整理匯總了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;
 }
開發者ID:nsiskov,項目名稱:zsticker,代碼行數:46,代碼來源:statusreport.php


注:本文中的DbUtil::getConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。