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


PHP db_assoc_arr函数代码示例

本文整理汇总了PHP中db_assoc_arr函数的典型用法代码示例。如果您正苦于以下问题:PHP db_assoc_arr函数的具体用法?PHP db_assoc_arr怎么用?PHP db_assoc_arr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getProfilesMatch

function getProfilesMatch($iPID1 = 0, $iPID2 = 0)
{
    $iPID1 = (int) $iPID1;
    $iPID2 = (int) $iPID2;
    if (!$iPID1 or !$iPID2) {
        return 0;
    }
    if ($iPID1 == $iPID2) {
        return 0;
    }
    //maybe need to return 100?? :)
    // try to find in cache
    $sQuery = "SELECT `Percent` FROM `ProfilesMatch` WHERE `PID1` = {$iPID1} AND `PID2` = {$iPID2}";
    $aPercent = db_assoc_arr($sQuery);
    if ($aPercent) {
        return (int) $aPercent['Percent'];
    }
    //not found in cache
    $aProf1 = getProfileInfo($iPID1);
    $aProf2 = getProfileInfo($iPID2);
    if (!$aProf1 or !$aProf2) {
        return 0;
    }
    $oPF = new BxDolProfileFields(101);
    //matching area
    $iMatch = $oPF->getProfilesMatch($aProf1, $aProf2);
    //write to cache
    $sQuery = "INSERT INTO `ProfilesMatch` ( `PID1`, `PID2`, `Percent` ) VALUES ( {$iPID1}, {$iPID2}, {$iMatch} )";
    db_res($sQuery);
    return $iMatch;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:match.inc.php

示例2: PageListFriend

function PageListFriend($sourceID, $targetID)
{
    $ret = '';
    $query = "SELECT * FROM `FriendList` WHERE (`ID` = '{$sourceID}' and `Profile` = '{$targetID}') or ( `ID` = '{$targetID}' and `Profile` = '{$sourceID}')";
    $temp = db_assoc_arr($query);
    if ($sourceID == $temp['ID'] || $temp['Check'] == 1) {
        $ret = _t_action('_already_in_friend_list');
    } elseif ($targetID == $temp['ID'] && 0 == $temp['Check']) {
        $query = "UPDATE `FriendList` SET `Check` = '1' WHERE `ID` = '{$targetID}' AND `Profile` = '{$sourceID}';";
        if (db_res($query)) {
            $ret = _t_action('_User was added to friend list');
        } else {
            $ret = _t_err('_Failed to apply changes');
        }
    } else {
        $query = "INSERT INTO `FriendList` SET `ID` = '{$sourceID}', `Profile` = '{$targetID}', `Check` = '0';";
        if (db_res($query)) {
            $ret = _t_action('_User was invited to friend list');
        } else {
            $ret = _t_err('_Failed to apply changes');
        }
    }
    return $ret;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:24,代码来源:list_pop.php

示例3: showPropForm

    function showPropForm($iBlockID)
    {
        $sQuery = "SELECT * FROM `{$this->sDBTable}` WHERE `Page` = '{$this->sPage_db}' AND `ID` = {$iBlockID}";
        $aItem = db_assoc_arr($sQuery);
        if (!$aItem) {
            ?>
			<div style="text-align:center;color:red;">This block has no properties</div>
			<?php 
            return;
        }
        ?>
<form name="formItemEdit" id="formItemEdit" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
" method="POST">
	<input type="hidden" name="Page" value="<?php 
        echo htmlspecialchars($this->oPage->sName);
        ?>
" />
	<input type="hidden" name="id" value="<?php 
        echo $iBlockID;
        ?>
" />
	<input type="hidden" name="action" value="saveItem" />
	
	<table class="popup_form_wrapper">
		<tr>
			<td class="corner"><img src="images/op_cor_tl.png" /></td>
			<td class="side_ver"><img src="images/spacer.gif" /></td>
			<td class="corner"><img src="images/op_cor_tr.png" /></td>
		</tr>
		<tr>
			<td class="side"><img src="images/spacer.gif" /></td>
			
			<td class="container">
				<div class="edit_item_table_cont">
				
					<table class="edit_item_table" >
						<tr>
							<td class="form_label">Type:</td>
							<td>
								<?php 
        switch ($aItem['Func']) {
            case 'PFBlock':
                echo 'Profile Fields';
                break;
            case 'Echo':
                echo 'HTML Block';
                break;
            case 'RSS':
                echo 'RSS Feed';
                break;
            default:
                echo 'Special Block';
        }
        ?>
							</td>
						</tr>
						<tr>
							<td class="form_label">Description:</td>
							<td><?php 
        echo $aItem['Desc'];
        ?>
</td>
						</tr>
						<tr>
							<td class="form_label">Caption Lang Key:</td>
							<td>
								<input type="text" class="form_input_text" name="Caption" value="<?php 
        echo $aItem['Caption'];
        ?>
" />
							</td>
						</tr>
						<tr>
							<td class="form_label">Visible for:</td>
							<td>
								<label>
									<input type="checkbox" name="Visible[]" value="non"
									  <?php 
        echo strpos($aItem['Visible'], 'non') === false ? '' : 'checked="checked"';
        ?>
 />
									Guest
								</label>
								
								<label>
									<input type="checkbox" name="Visible[]" value="memb"
									  <?php 
        echo strpos($aItem['Visible'], 'memb') === false ? '' : 'checked="checked"';
        ?>
 />
									Member
								</label>
							</td>
						</tr>
	<?php 
        if ($aItem['Func'] == 'Echo') {
            ?>
						<tr>
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:101,代码来源:BxDolPageViewAdmin.php

示例4: serviceGetWallPost

 function serviceGetWallPost($aEvent)
 {
     $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1");
     $aMusic = $this->serviceGetMusicArray($aEvent['object_id'], 'browse');
     if (empty($aOwner) || empty($aMusic)) {
         return "";
     }
     $sCss = "";
     if ($aEvent['js_mode']) {
         $sCss = $this->oModule->_oTemplate->addCss('wall_post.css', true);
     } else {
         $this->oModule->_oTemplate->addCss('wall_post.css');
     }
     $sAddedNewTxt = _t('_bx_sounds_wall_added_new');
     if (!$this->oModule->oAlbumPrivacy->check('album_view', $aMusic['album_id'], $this->oModule->_iProfileId)) {
         $sMusicTxt = _t('_bx_sounds_wall_music_private');
         $aOut = array('title' => $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sMusicTxt, 'content' => $sCss . $this->oTemplate->parseHtmlByName('wall_post_private.html', array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt . ' ' . $sMusicTxt, 'post_id' => $aEvent['id'])));
     } else {
         $sMusicTxt = _t('_bx_sounds_wall_music');
         $aOut = array('title' => $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sMusicTxt, 'description' => $aMusic['description'], 'content' => $sCss . $this->oTemplate->parseHtmlByName('wall_post.html', array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt, 'cpt_music_url' => $aMusic['url'], 'cpt_music' => $sMusicTxt, 'cnt_player' => $this->_getSharedThumb($aEvent['object_id'], $aMusic['url']), 'post_id' => $aEvent['id'])));
     }
     return $aOut;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:23,代码来源:BxSoundsSearch.php

示例5: getParamDesc

function getParamDesc($param_name)
{
    if (!($line = db_assoc_arr("SELECT `desc` FROM `GlParams` WHERE `Name` = '{$param_name}'"))) {
        return false;
    }
    return $line['desc'];
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:7,代码来源:db.inc.php

示例6: deleteGroupImage

 function deleteGroupImage($iGroupID, $img)
 {
     $iGroupID = (int) $iGroupID;
     $img = (int) $img;
     if ($iGroupID and $img) {
         $arrImg = db_assoc_arr("SELECT * FROM `GroupsGallery` WHERE `groupID`='{$iGroupID}' AND `ID`='{$img}'");
         if ($arrImg['ID'] == $img) {
             db_res("DELETE FROM `GroupsGallery` WHERE `ID`='{$img}' AND `groupID`='{$iGroupID}'");
             unlink($this->sGrpGalPath . "{$iGroupID}_{$img}_{$arrImg['seed']}_.{$arrImg['ext']}");
             unlink($this->sGrpGalPath . "{$iGroupID}_{$img}_{$arrImg['seed']}.{$arrImg['ext']}");
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:13,代码来源:BxDolGroups.php

示例7: getProfileInfo

 function getProfileInfo($iMemberID)
 {
     return db_assoc_arr("SELECT * FROM `Profiles` WHERE `ID` = " . (int) $iMemberID);
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:4,代码来源:BxDolProfilesController.php

示例8: member_auth

// Check if administrator is logged in.  If not display login form.
$logged['admin'] = member_auth(1, true, true);
if (bx_get('action') !== false) {
    switch (bx_get('action')) {
        case 'edit_form':
            $id = (int) bx_get('id');
            if ($id < 1000) {
                $aItem = db_assoc_arr("SELECT * FROM `sys_menu_admin` WHERE `id` = '{$id}'", 0);
                if ($aItem) {
                    echo showEditFormCustom($aItem);
                } else {
                    echo echoMenuEditMsg(_t('_Error'), 'red');
                }
            } else {
                $id = $id - 1000;
                $aItem = db_assoc_arr("SELECT * FROM `sys_menu_admin` WHERE `id` = '{$id}' AND `parent_id`='0'", 0);
                if ($aItem) {
                    echo showEditFormTop($aItem);
                } else {
                    echo echoMenuEditMsg(_t('_Error'), 'red');
                }
            }
            exit;
        case 'create_item':
            $newID = createNewElement($_POST['type'], (int) $_POST['source']);
            echo $newID;
            exit;
        case 'deactivate_item':
            $id = (int) bx_get('id');
            if ($id > 1000) {
                $id = $id - 1000;
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:31,代码来源:menu_compose_admin.php

示例9: switch

<?php

if ($_REQUEST['action']) {
    switch ($_REQUEST['action']) {
        case 'edit_form':
            $id = (int) $_REQUEST['id'];
            $aItem = db_assoc_arr("SELECT * FROM `{$sTableName}` WHERE `ID` = {$id}", 0);
            if ($aItem) {
                $aItem['Deletable'] = false;
                if ($aItem['Func'] == 'Echo') {
                    $aItem['Deletable'] = true;
                } else {
                    $iTypeNum = (int) db_value("SELECT COUNT( * ) FROM `{$sTableName}` WHERE `Func` = '{$aItem['Func']}'");
                    if ($iTypeNum > 1) {
                        $aItem['Deletable'] = true;
                    }
                }
                showEditForm($aItem);
            } else {
                echoMenuEditMsg('Error', 'red');
            }
            exit;
        case 'create_item':
            $newID = createNewElement((int) $_GET['source']);
            echo $newID;
            exit;
        case 'deactivate_item':
            echo "OK";
            //moved it to Col 0
            exit;
        case 'save_item':
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:pageComposer.php

示例10: deleteItem

 function deleteItem($iItemID)
 {
     $this->genSaveItemHeader();
     $aItem = db_assoc_arr("SELECT * FROM `ProfileFields` WHERE `ID` = {$iItemID}");
     if (!$aItem) {
         $this->genSaveItemError('Warning! Item not found.');
     } elseif ($aItem['Type'] == 'system' or !(int) $aItem['Deletable']) {
         $this->genSaveItemError('The field cannot be deleted.');
     } else {
         $sQuery = "DELETE FROM `ProfileFields` WHERE `ID` = {$iItemID}";
         db_res($sQuery);
         if ($aItem['Type'] == 'block') {
             db_res("DELETE FROM `PageCompose` WHERE `Func` = 'PFBlock' AND `Content` = '{$iItemID}'");
         } else {
             db_res("ALTER TABLE `Profiles` DROP `{$aItem['Name']}`");
         }
         $this->genSaveItemFormUpdate('deleteItem', $iItemID);
         //$this -> genSaveItemFormClose();
     }
     $this->genSaveItemFooter();
 }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:21,代码来源:BxDolPFM.php

示例11: getPageInfo

 function getPageInfo($iID)
 {
     return db_assoc_arr("SELECT * FROM `ml_clonetwo_main` WHERE `id` = " . (int) $iID);
 }
开发者ID:scriptologist,项目名称:Multi-Module-Creator-Plus,代码行数:4,代码来源:MlClonetwoController.php

示例12: deleteGroupImage

function deleteGroupImage($groupID, $img)
{
    $groupID = (int) $groupID;
    $img = (int) $img;
    if ($groupID and $img) {
        $arrImg = db_assoc_arr("SELECT * FROM `GroupsGallery` WHERE `groupID`={$groupID} AND `ID`={$img}");
        if ($arrImg['ID'] == $img) {
            db_res("DELETE FROM `GroupsGallery` WHERE `ID`={$img} AND `groupID`={$groupID}");
            unlink(BX_DIRECTORY_PATH_GROUPS_GALLERY . "{$groupID}_{$img}_{$arrImg['seed']}_.{$arrImg['ext']}");
            unlink(BX_DIRECTORY_PATH_GROUPS_GALLERY . "{$groupID}_{$img}_{$arrImg['seed']}.{$arrImg['ext']}");
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:13,代码来源:groups.inc.php

示例13: serviceGetWallPost

 function serviceGetWallPost($aEvent)
 {
     $sAddedNewTxt = _t('_bx_ads_wall_added_new');
     $sPostTxt = _t('_bx_ads_wall_photo');
     $iObjectID = (int) $aEvent['object_id'];
     $aOwner = db_assoc_arr("SELECT `ID` AS `id`, `NickName` AS `username` FROM `Profiles` WHERE `ID`='" . (int) $aEvent['owner_id'] . "' LIMIT 1");
     $sTitle = $aOwner['username'] . ' ' . $sAddedNewTxt . ' ' . $sPostTxt;
     $aPostInfo = $this->_oDb->getAdInfo($iObjectID);
     $sCaption = $aPostInfo['Subject'];
     $sEntryUrl = $this->genUrl($iObjectID, $aPostInfo['EntryUri'], 'entry');
     $sCss = '';
     if ($aEvent['js_mode']) {
         $sCss = $this->_oTemplate->addCss('wall_post.css', true);
     } else {
         $this->_oTemplate->addCss('wall_post.css');
     }
     $aVars = array('cpt_user_name' => $aOwner['username'], 'cpt_added_new' => $sAddedNewTxt, 'cpt_object' => $sPostTxt, 'cpt_item_url' => $sEntryUrl, 'post_id' => $aEvent['id']);
     return array('title' => $sTitle, 'description' => $sTitle, 'content' => $sCss . $this->_oTemplate->parseHtmlByName('wall_post.html', $aVars));
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:19,代码来源:BxAdsModule.php

示例14: PageListFriend

/**
 * Put to friends list
 *
 * @param $iProfileId integer
 * @param $iMemberId integer
 * @return text - html presentation data
 */
function PageListFriend($iProfileId, $iMemberId = 0)
{
    $sOutputCode = '';
    $iProfileId = (int) $iProfileId;
    $iMemberId = (int) $iMemberId;
    if (!$iMemberId || !getProfileInfo($iMemberId)) {
        return MsgBox(_t('_Failed to apply changes'));
    }
    // block members
    if (isBlocked($iMemberId, $iProfileId)) {
        return MsgBox(_t('_You have blocked by this profile'));
    }
    //check friends pair
    $aFriendsInfo = db_assoc_arr("SELECT * FROM `sys_friend_list`\n        WHERE (`ID`='{$iProfileId}' AND `Profile`='{$iMemberId}')\n            OR (`ID`='{$iMemberId}' AND `Profile` = '{$iProfileId}')");
    //-- process friend request --//
    if ($aFriendsInfo) {
        if (isset($aFriendsInfo['Check']) && $aFriendsInfo['Check'] == 1) {
            $sOutputCode = MsgBox(_t('_already_in_friend_list'));
        } else {
            if (isset($aFriendsInfo['ID'], $aFriendsInfo['Check'])) {
                if ($iProfileId == $aFriendsInfo['ID'] && $aFriendsInfo['Check'] == 0) {
                    $sOutputCode = MsgBox(_t('_pending_friend_request'));
                } else {
                    //make paier as friends
                    $sQuery = "UPDATE `sys_friend_list` SET `Check` = '1'\n                    WHERE `ID` = '{$iMemberId}' AND `Profile` = '{$iProfileId}';";
                    if (db_res($sQuery, 0)) {
                        $sOutputCode = MsgBox(_t('_User was added to friend list'));
                        //send system alert
                        bx_import('BxDolAlerts');
                        $oZ = new BxDolAlerts('friend', 'accept', $iMemberId, $iProfileId);
                        $oZ->alert();
                    } else {
                        $sOutputCode = MsgBox(_t('_Failed to apply changes'));
                    }
                }
            } else {
                $sOutputCode = MsgBox(_t('_Failed to apply changes'));
            }
        }
    } else {
        //create new friends request
        $sQuery = "INSERT INTO `sys_friend_list` SET\n            `ID` = '{$iProfileId}', `Profile` = '{$iMemberId}', `Check` = '0'";
        if (db_res($sQuery, 0)) {
            $sOutputCode = MsgBox(_t('_User was invited to friend list'));
            //send system alert
            bx_import('BxDolAlerts');
            $oZ = new BxDolAlerts('friend', 'request', $iMemberId, $iProfileId);
            $oZ->alert();
            // send email notification
            $oEmailTemplate = new BxDolEmailTemplates();
            $aTemplate = $oEmailTemplate->getTemplate('t_FriendRequest', $iMemberId);
            $aRecipient = getProfileInfo($iMemberId);
            $aPlus = array('Recipient' => getNickName($aRecipient['ID']), 'SenderLink' => getProfileLink($iProfileId), 'Sender' => getNickName($iProfileId), 'RequestLink' => BX_DOL_URL_ROOT . 'communicator.php?communicator_mode=friends_requests');
            sendMail($aRecipient['Email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);
        } else {
            $sOutputCode = MsgBox(_t('_Failed to apply changes'));
        }
    }
    //--
    return $sOutputCode;
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:68,代码来源:list_pop.php

示例15: switch

$_page['header'] = 'Admin Menu Builder';
$_page['css_name'] = 'menu_compose.css';
if ($_REQUEST['action']) {
    switch ($_REQUEST['action']) {
        case 'edit_form':
            $id = (int) $_REQUEST['id'];
            if ($id < 1000) {
                $aItem = db_assoc_arr("SELECT * FROM `AdminMenu` WHERE `ID` = {$id}", 0);
                if ($aItem) {
                    showEditFormCustom($aItem);
                } else {
                    echoMenuEditMsg('Error', 'red');
                }
            } else {
                $id = $id - 1000;
                $aItem = db_assoc_arr("SELECT * FROM `AdminMenuCateg` WHERE `ID` = {$id}", 0);
                if ($aItem) {
                    showEditFormTop($aItem);
                } else {
                    echoMenuEditMsg('Error', 'red');
                }
            }
            exit;
        case 'create_item':
            $newID = createNewElement($_GET['type'], (int) $_GET['source']);
            echo $newID;
            exit;
        case 'deactivate_item':
            $id = (int) $_GET['id'];
            if ($id > 1000) {
                $id = $id - 1000;
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:adminMenuCompose.php


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