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


PHP db_array函数代码示例

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


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

示例1: Photo_Stream

function Photo_Stream($userid, $friends = true)
{
    if ($friends) {
        return db_array('SELECT
                     photos.id AS photoid,
                     users.name AS username,
                     photos.title
                 FROM
                     photos CROSS JOIN users
                        ON photos.userid = users.id
                     CROSS JOIN friendships
                        ON users.id = friendships.following
                 WHERE
                     follower = ?
                 LIMIT 100', array($userid));
    }
    return db_array('SELECT
                photos.id AS photoid,
                users.name AS username,
                photos.title
             FROM
                photos CROSS JOIN users
                    ON photos.userid = users.id
             LIMIT 100');
}
开发者ID:Hepic,项目名称:web-class,代码行数:25,代码来源:photo.php

示例2: ilist_by_category

 public function ilist_by_category($att_categories_id)
 {
     $where = array('status' => 0);
     if ($att_categories_id > 0) {
         $where['att_categories_id'] = $att_categories_id;
     }
     return db_array($this->table_name, $where, 'add_time desc');
 }
开发者ID:osalabs,项目名称:osafw-php,代码行数:8,代码来源:Att.php

示例3: ilist

 public function ilist($parent_id = NULL)
 {
     $where = '';
     if (!is_null($parent_id)) {
         $where .= 'and parent_id=' . dbq($parent_id);
     }
     return db_array("select * from " . $this->table_name . " where status=0 {$where} order by parent_id, prio desc, iname");
 }
开发者ID:osalabs,项目名称:osafw-php,代码行数:8,代码来源:Categories.php

示例4: db_clear

function db_clear($tables = false)
{
    //cant find where this is called from.  obsolete?
    global $_josh;
    $sql = $_josh["db"]["language"] == "mssql" ? "SELECT name FROM sysobjects WHERE type='u' AND status > 0" : "SHOW TABLES FROM " . $_josh["db"]["database"];
    $tables = $tables ? explode(",", $tables) : db_array($sql);
    foreach ($tables as $table) {
        db_query("DELETE FROM " . $table);
    }
}
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:10,代码来源:db.php

示例5: authenticate

 public static function authenticate($username, $password)
 {
     $users = db_array('SELECT
                 id, name, password, hashing
             FROM
                 users
             WHERE
                 name = :username
             LIMIT 1', compact('username'));
     if (count($users)) {
         $storedCrypto = $users[0]['password'];
         $reEncrypted = blowfishEncrypt($password, $users[0]['hashing']);
         if ($reEncrypted['password'] == $storedCrypto) {
             return $users[0];
         }
     }
     return false;
 }
开发者ID:natureday1,项目名称:Life,代码行数:18,代码来源:user.php

示例6: listing

 public static function listing($userid, $includeprivate = true)
 {
     $visibility = array('public');
     if ($includeprivate) {
         $visibility[] = 'private';
     }
     $rows = db_array('SELECT
                 id, text, type, created, visibility, userid
             FROM
                 posts
             WHERE
                 userid = :userid
                 AND visibility IN :visibility
                 AND deleted != "yes"
             ORDER BY
                 DATE( created ) DESC, TIME( created ) ASC, id ASC', compact('userid', 'visibility'));
     foreach ($rows as $i => $row) {
         $rows[$i]['formatted'] = Post::format($row['text']);
     }
     return $rows;
 }
开发者ID:natureday1,项目名称:Life,代码行数:21,代码来源:post.php

示例7: ShowFormAction

 public function ShowFormAction($form_id)
 {
     $id = $form_id + 0;
     $dict_link_multi = array();
     if ($this->fw->route['method'] == 'GET') {
         if ($id > 0) {
             $item = $this->model->one($id);
             $item["ftime_str"] = DateUtils::int2timestr($item["ftime"]);
             $dict_link_multi = FormUtils::ids2multi($item['dict_link_multi']);
         } else {
             #defaults
             $item = array('fint' => 0, 'ffloat' => 0);
         }
     } else {
         $itemdb = $id ? $this->model->one($id) : array();
         $item = array_merge($itemdb, req('item'));
         $dict_link_multi = req('dict_link_multi');
     }
     $ps = array('id' => $id, 'i' => $item, 'add_user_id_name' => fw::model('Users')->full_name($item['add_user_id']), 'upd_user_id_name' => fw::model('Users')->full_name($item['upd_user_id']), 'select_options_parent_id' => FormUtils::select_options_db(db_array("select id, iname from {$this->table_name} where parent_id=0 and status=0 order by iname"), $item['parent_id']), 'select_options_demo_dicts_id' => $this->model_related->get_select_options($item['demo_dicts_id']), 'dict_link_auto_id_iname' => $item['dict_link_auto_id'] ? $this->model_related->iname($item['dict_link_auto_id']) : $item['dict_link_auto_id_iname'], 'multi_datarow' => $this->model_related->get_multi_list($dict_link_multi), 'att_id_url_s' => $this->fw->model('Att')->get_url_direct($item['att_id'], 's'));
     #combo date
     #TODO FormUtils::combo4date( $item['fdate_combo'], $ps, 'fdate_combo');
     return $ps;
 }
开发者ID:osalabs,项目名称:osafw-php,代码行数:23,代码来源:AdminDemos.php

示例8: upgrade_1284

function upgrade_1284()
{
    # migrate the ALL domain to the superadmin column
    # Note: The ALL domain is not (yet) deleted to stay backwards-compatible for now (will be done in a later upgrade function)
    $result = db_query("SELECT username FROM " . table_by_key('domain_admins') . " where domain='ALL'");
    if ($result['rows'] > 0) {
        while ($row = db_array($result['result'])) {
            printdebug("Setting superadmin flag for " . $row['username']);
            db_update('admin', 'username', $row['username'], array('superadmin' => db_get_boolean(true)));
        }
    }
}
开发者ID:stepkh,项目名称:postfixadmin,代码行数:12,代码来源:upgrade.php

示例9: array

<?
if(!check_perms('admin_dnu')) { error(403); }

if($_POST['submit'] == 'Delete'){ //Delete
	if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
	$DB->query('DELETE FROM do_not_upload WHERE ID='.$_POST['id']);
} else { //Edit & Create, Shared Validation
	$Val->SetFields('name', '1','string','The name must be set, and has a max length of 40 characters', array('maxlength'=>40, 'minlength'=>1));
	$Val->SetFields('comment', '0','string','The description has a max length of 255 characters', array('maxlength'=>255));
	$Err=$Val->ValidateForm($_POST); // Validate the form
	if($Err){ error($Err); }

	$P=array();
	$P=db_array($_POST); // Sanitize the form

	if($_POST['submit'] == 'Edit'){ //Edit
		if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
		$DB->query("UPDATE do_not_upload SET
			Name='$P[name]',
			Comment='$P[comment]',
			UserID='$LoggedUser[ID]',
			Time='".sqltime()."'
			WHERE ID='$P[id]'");
	} else { //Create
		$DB->query("INSERT INTO do_not_upload 
			(Name, Comment, UserID, Time) VALUES
			('$P[name]','$P[comment]','$LoggedUser[ID]','".sqltime."')");
	}
}

// Go back
开发者ID:4play,项目名称:gazelle2,代码行数:31,代码来源:dnu_alter.php

示例10: FOUND_ROWS

    }
} else {
    $QueryID = $DB->query("\n\t\tSELECT\n\t\t\tSQL_CALC_FOUND_ROWS\n\t\t\tIP,\n\t\t\tStartTime,\n\t\t\tEndTime\n\t\tFROM users_history_ips\n\t\tWHERE UserID = '{$UserID}'\n\t\t\t{$SearchIPQuery}\n\t\tORDER BY StartTime DESC\n\t\tLIMIT {$Limit}");
}
if (isset($QueryID)) {
    $DB->query('SELECT FOUND_ROWS()');
    list($NumResults) = $DB->next_record();
    $DB->set_query_id($QueryID);
    $Results = $DB->to_array(false, MYSQLI_ASSOC);
    $IPMatches = $IPMatchesUser = $IPMatchesIgnored = array();
} else {
    $NumResults = 0;
    $Results = array();
}
if (!empty($Results)) {
    $IPs = db_array($DB->collect('IP'), array(), true);
    $DB->query("\n\t\tSELECT\n\t\t\tUserID,\n\t\t\tIP,\n\t\t\tStartTime,\n\t\t\tEndTime\n\t\tFROM users_history_ips\n\t\tWHERE IP IN (" . implode(',', $IPs) . ")\n\t\t\tAND UserID != '{$UserID}'\n\t\t\tAND UserID != 0\n\t\tORDER BY StartTime DESC");
    unset($IPs);
    while ($Match = $DB->next_record(MYSQLI_ASSOC)) {
        $OtherIP = $Match['IP'];
        $OtherUserID = $Match['UserID'];
        if (!isset($IPMatchesUser[$OtherIP][$OtherUserID])) {
            $IPMatchesUser[$OtherIP][$OtherUserID] = 0;
        }
        if ($IPMatchesUser[$OtherIP][$OtherUserID] < 500) {
            $IPMatches[$OtherIP][] = $Match;
        } else {
            if (!isset($IPMatchesIgnored[$OtherIP][$OtherUserID])) {
                $IPMatchesIgnored[$OtherIP][$OtherUserID] = 0;
            }
            $IPMatchesIgnored[$OtherIP][$OtherUserID]++;
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:ip_history.php

示例11: array_post_checkboxes

        $channels = array_post_checkboxes('channels');
        $languages = db_table('SELECT id, code FROM languages');
        foreach ($languages as $l) {
            $addresses = db_array('SELECT DISTINCT u.email FROM users u JOIN users_to_channels_prefs u2cp ON u.id = u2cp.user_id WHERE u.is_active = 1 AND u.language_id = ' . $l['id'] . ' AND u2cp.channel_id IN (' . implode(',', $channels) . ')');
            $topic = db_grab('SELECT 
						ISNULL(u.nickname, u.firstname) firstname, 
						u.lastname, 
						t.title' . langExt($l['code']) . ' title, 
						t.description' . langExt($l['code']) . ' description, 
						y.title' . langExt($l['code']) . ' type,
						t.created_date
					FROM bb_topics t
					LEFT JOIN bb_topics_types y ON t.type_id = y.id
					JOIN users u ON t.created_user = u.id
					WHERE t.id = ' . $id);
            $channels_text = db_array('SELECT title' . langExt($l['code']) . ' FROM channels WHERE id IN (' . implode(',', $channels) . ')');
            $channels_text = implode(', ', $channels_text);
            $message = '<p style="font-weight:bold;">' . $topic['firstname'] . ' ' . $topic['lastname'] . ' ' . getString('bb_notify', $l['code']) . '</p>
				<p>' . getString('title', $l['code']) . ': ' . draw_link(url_base() . '/bb/topic.php?id=' . $id, $topic['title']) . '</p>
				<p>' . getString('channels_label', $l['code']) . ': ' . $channels_text . '</p>';
            if ($topic['type']) {
                $message .= '<p>' . getString('category', $l['code']) . ': ' . $topic['type'] . '</p>';
            }
            $message .= '<div style="color:#555; border-top:1px dotted #555; padding-top:5px; margin-top:5px;">' . $topic['description'] . '</div>';
            emailUser($addresses, $topic['title'], $message);
        }
    }
    bbDrawRss();
    url_change();
}
echo drawTop(drawSyndicateLink('bb'));
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:index.php

示例12: db_query

include "include.php";
if (isset($_GET["deleteID"])) {
    if (db_grab("SELECT endDate FROM intranet_users WHERE userID = " . $_GET["deleteID"])) {
        db_query("UPDATE intranet_users SET isActive = 0, deletedBy = {$user["id"]}, deletedOn = GETDATE() WHERE userID = " . $_GET["deleteID"]);
    } else {
        db_query("UPDATE intranet_users SET isActive = 0, deletedBy = {$user["id"]}, deletedOn = GETDATE(), endDate = GETDATE() WHERE userID = " . $_GET["deleteID"]);
    }
    url_query_drop("deleteID");
}
$orgs = array();
if (!isset($_GET["id"])) {
    $_GET["id"] = 0;
}
$orgs[0] = "Shared";
$orgs = db_array("SELECT id, description FROM organizations ORDER BY description", $orgs);
drawTop();
?>
<table class="navigation staff" cellspacing="1">
	<tr class="staff-hilite">
		<?php 
foreach ($orgs as $key => $value) {
    ?>
		<td width="14.28%"<?php 
    if ($_GET["id"] == $key) {
        ?>
 class="selected"<?php 
    }
    ?>
><?php 
    if ($_GET["id"] != $key) {
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:30,代码来源:organizations.php

示例13: get_combo_select_sql

 public static function get_combo_select_sql($sql, $sel_value)
 {
     $rows = db_array($sql);
     $result = '';
     foreach ($rows as $k => $row) {
         $value = $row['id'];
         $desc = $row['iname'];
         if (!$value && !$desc) {
             continue;
         }
         if ($value == $sel_value) {
             $result .= "<option value=\"{$value}\" selected>{$desc}\n";
         } else {
             $result .= "<option value=\"{$value}\">{$desc}\n";
         }
     }
     return $result;
 }
开发者ID:osalabs,项目名称:osafw-php,代码行数:18,代码来源:FormUtils.php

示例14: get_details

 /**
  * Retrieve information on someone who is on vacation
  * @return struct|boolean stored information on vacation - array(subject - string, message - string, active - boolean, activeFrom - date, activeUntil - date) 
  * will return false if no existing data 
  */
 function get_details()
 {
     $table_vacation = table_by_key('vacation');
     $E_username = escape_string($this->username);
     $sql = "SELECT * FROM {$table_vacation} WHERE email = '{$E_username}'";
     $result = db_query($sql);
     if ($result['rows'] != 1) {
         return false;
     }
     $row = db_array($result['result']);
     $boolean = $row['active'] == db_get_boolean(true);
     # TODO: only return true and store the db result array in $this->whatever for consistency with the other classes
     return array('subject' => $row['subject'], 'body' => $row['body'], 'active' => $boolean, 'interval_time' => $row['interval_time'], 'activeFrom' => $row['activefrom'], 'activeUntil' => $row['activeuntil']);
 }
开发者ID:port22,项目名称:mail,代码行数:19,代码来源:VacationHandler.php

示例15: resource

/* ----------------------- ПАРАМЕТРЫ СТРАНИЦЫ ----------------------- */
$page['title'] = 'Лог';
$page['desc'] = 'Лог сервера';
resource(['datatables/datatables/media/css/jquery.dataTables.min.css', 'datatables/datatables/media/js/jquery.dataTables.min.js', <<<JS
    \$(document).ready(function() {
        \$('table').DataTable( {
            "language": {
                "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Russian.json"
            }
        } );
    } );
JS
]);
/* ---------------------- КОНТРОЛЛЕР СТРАНИЦЫ ----------------------- */
// Запрашиваем записи лога, относящиеся к API
$logs = db_array("SELECT *, " . "DATE_FORMAT(`created_at`, '%d.%m.%y в %H:%m:%s') AS `time` " . "FROM `log`" . "WHERE `type` = 'API'" . "ORDER BY `created_at` DESC");
/* -------------------------- ОТОБРАЖЕНИЕ ------------ */
ob_start();
?>

<h2>Лог запросов к серверу</h2>
<hr />
<table class="display" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>ID</th>
            <th>Время</th>
            <th>Значение</th>
        </tr>
    </thead>
    <tbody>
开发者ID:phizio,项目名称:phix_example,代码行数:31,代码来源:log.php


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