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


PHP db_grab函数代码示例

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


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

示例1: drawJumpToStaff

function drawJumpToStaff($selectedID = false)
{
    global $page;
    $nullable = $selectedID === false;
    $return = drawPanel(getString('jump_to') . ' ' . drawSelectUser('', $selectedID, $nullable, 0, true, true, 'Staff Member:'));
    if ($page['is_admin'] && db_grab('SELECT COUNT(*) FROM users_requests WHERE is_active = 1')) {
        $return = drawMessage('There are pending <a href="requests.php">account requests</a> for you to review.') . $return;
    }
    return $return;
}
开发者ID:Rhenan,项目名称:intranet-1,代码行数:10,代码来源:include.php

示例2: drawJumpToStaff

function drawJumpToStaff($selectedID = false)
{
    global $isAdmin;
    $nullable = $selectedID === false;
    $return = '
		<table class="message">
			<tr>
				<td class="gray">Jump to ' . drawSelectUser("", $selectedID, $nullable, 0, true, true, "Staff Member:") . '</td>
			</tr>
		</table>';
    if ($isAdmin) {
        if ($r = db_grab("SELECT COUNT(*) FROM users_requests")) {
            $return = drawServerMessage("There are pending <a href='requests.php'>account requests</a> for you to review.") . $return;
        }
    }
    return $return;
}
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:17,代码来源:include.php

示例3: url_query_require

<?php

include '../include.php';
url_query_require();
echo drawTop();
$r = db_grab('SELECT
		(SELECT t.tag FROM contacts_tags t JOIN contacts_to_tags c2t ON t.id = c2t.tag_id WHERE t.is_active = 1 AND t.type_id = 10 AND c2t.contact_id = c.id) salutation,
		c.firstname,
		c.lastname,
		(SELECT t.tag FROM contacts_tags t JOIN contacts_to_tags c2t ON t.id = c2t.tag_id WHERE t.is_active = 1 AND t.type_id = 11 AND c2t.contact_id = c.id) suffix,
		c.organization,
		c.title,
		c.address_1,
		c.address_2,
		RIGHT("00000" + RTRIM(c.zip), 5) zip,
		c.phone,
		c.fax,
		c.mobile_phone,
		c.email,
		z.city,
		z.state,
		c.notes
	FROM contacts c
	LEFT JOIN zip_codes z ON c.zip = z.zip
	WHERE c.id = ' . $_GET['id']);
$d = new display();
$d->row('Name', $r['salutation'] . ' ' . $r['firstname'] . ' ' . $r['lastname'] . ($r['suffix'] ? ', ' . $r['suffix'] : ''));
$d->row('Company', $r['organization']);
$d->row('Job Title', $r['title']);
$d->row('Address', $r['address_1'] . ($r['address_2'] ? BR . $r['address_2'] : false) . BR . $r['city'] . ', ' . $r['state'] . ' ' . $r['zip']);
$d->row('Phone', $r['phone']);
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:contact.php

示例4: db_query

<?php

include "../../include.php";
if ($posting) {
    $theuser_id = $page['is_admin'] ? $_POST["created_user"] : $_SESSION["user_id"];
    db_query("UPDATE press_releases SET\n\t\t\theadline       = '{$_POST["headline"]}',\t\n\t\t\tdetail         = '{$_POST["detail"]}',\t\n\t\t\tlocation       = '{$_POST["location"]}',\t\n\t\t\ttext           = '" . format_html($_POST["text"]) . "',\t\n\t\t\tcorporationID = {$_POST["corporationID"]},\n\t\t\tupdated_date     = GETDATE(),\n\t\t\tupdated_user     = {$theuser_id}\n\t\t\tWHERE id = " . $_GET["id"]);
    url_change("../?id=" . $_GET["id"]);
}
echo drawTop();
$r = db_grab("SELECT id, headline, detail, location, releaseDate, corporationID, text FROM press_releases WHERE id = " . $_GET["id"]);
$form = new intranet_form();
if ($page['is_admin']) {
    $form->addUser("created_user", "Posted By", $_SESSION["user_id"], false, "EEDDCC");
}
$form->addRow("itext", "Headline", "headline", $r["headline"], "", true, 255);
$form->addRow("itext", "Detail", "detail", $r["detail"], "", false, 255);
$form->addRow("itext", "Location", "location", $r["location"], "", true, 255);
$form->addRow("select", "Organization", "corporationID", "SELECT id, title from organizations ORDER BY title", $r["corporationID"]);
$form->addRow("date", "Date", "releaseDate", $r["releaseDate"]);
$form->addRow("textarea", "Text", "text", $r["text"], "", true);
$form->addRow("submit", "update press release");
$form->draw("Update Release");
echo drawBottom();
开发者ID:Rhenan,项目名称:intranet-1,代码行数:23,代码来源:edit.php

示例5: GETDATE

<?php

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 
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:31,代码来源:organizations.php

示例6: login

function login($username, $password, $skippass = false)
{
    global $_SESSION;
    //need id, fullname, email departmentid, ishelpdesk, homepage, update_days, updated_on, first
    if ($skippass) {
        $where = '';
        error_debug('<b>login</b> running without password', __FILE__, __LINE__);
    } else {
        $where = ' AND ' . db_pwdcompare($password, 'u.password') . ' = 1';
        error_debug('<b>login</b> running with password', __FILE__, __LINE__);
    }
    if ($user = db_grab('SELECT 
		u.id,
		ISNULL(u.nickname, u.firstname) firstname,
		u.lastname,
		u.email,
		' . db_pwdcompare('', 'u.password') . ' password,
		u.departmentID,
		d.isHelpdesk,
		u.help,
		u.is_admin,
		u.updated_date,
		u.language_id,
		l.code language,
		' . db_datediff('u.updated_date', 'GETDATE()') . ' update_days
	FROM users u
	LEFT JOIN languages l ON u.language_id = l.id
	LEFT JOIN departments d ON u.departmentID = d.departmentID
	WHERE u.email = \'' . $username . '\' AND u.is_active = 1' . $where)) {
        //login was good
        db_query('UPDATE users SET lastlogin = GETDATE() WHERE id = ' . $user['id']);
        $_SESSION['user_id'] = $user['id'];
        $_SESSION['is_admin'] = $user['is_admin'];
        $_SESSION['email'] = $user['email'];
        $_SESSION['homepage'] = '/bb/';
        $_SESSION['departmentID'] = $user['departmentID'];
        $_SESSION['isHelpdesk'] = $user['isHelpdesk'];
        $_SESSION['update_days'] = $user['update_days'];
        $_SESSION['updated_date'] = $user['updated_date'];
        $_SESSION['password'] = $user['password'];
        $_SESSION['language_id'] = $user['language_id'];
        $_SESSION['language'] = $user['language'];
        $_SESSION['full_name'] = $user['firstname'] . ' ' . $user['lastname'];
        $_SESSION['isLoggedIn'] = true;
        cookie('last_login', $user['email']);
        cookie('last_email', $user['email']);
        return true;
    }
    $_SESSION['user_id'] = false;
    return false;
}
开发者ID:Rhenan,项目名称:intranet-1,代码行数:51,代码来源:include.php

示例7: drawTop

<?php

include "../include.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "a";
}
echo drawTop();
$r = db_grab("SELECT tt.name, t.type_id, t.tag FROM contacts_tags t INNER JOIN contacts_tags_types tt ON t.type_id = tt.id WHERE t.id = " . $_GET["id"]);
?>
<table class="left" cellspacing="1">
	<?php 
echo drawHeaderRow($r["tag"], 4);
?>
	<tr>
		<th width="16"></th>
		<th width="27%" align="left">Name</th>
		<th width="48%" align="left">Company</th>
		<th width="25%" align="left">Phone</th>
	</tr>
	<?php 
$contacts = db_query("SELECT\r\n\t\t\t\t\t\to.id,\r\n\t\t\t\t\t\to.is_active,\r\n\t\t\t\t\t\ti.varchar_01 as firstname,\r\n\t\t\t\t\t\ti.varchar_02 as lastname,\r\n\t\t\t\t\t\ti.varchar_04 as organization,\r\n\t\t\t\t\t\ti.varchar_08 as phone,\r\n\t\t\t\t\t\ti.varchar_11 as email\r\n\t\t\t\t\tFROM contacts o\r\n\t\t\t\t\tJOIN contacts_instances i ON o.instanceCurrentID = i.id\r\n\t\t\t\t\tJOIN contacts_instances_to_tags i2t ON i.id = i2t.instanceID\r\n\t\t\t\t\tWHERE o.is_active = 1 AND i2t.tagID = {$_GET["id"]}\r\n\t\t\t\t\tORDER BY i.varchar_02, i.varchar_01");
while ($c = db_fetch($contacts)) {
    if (strlen($c["organization"]) > 40) {
        $c["organization"] = substr($c["organization"], 0, 39) . "...";
    }
    ?>
	<tr <?php 
    if (!$c["is_active"]) {
        ?>
 class="deleted"<?php 
    }
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:value.php

示例8: url_query_require

<?php

include 'include.php';
url_query_require('skills.php');
if (!($skill = db_grab('SELECT title FROM skills where isActive = 1 AND id = ' . url_id()))) {
    url_chagne('skills.php');
}
echo drawTop();
echo drawTableStart();
if ($isAdmin) {
    echo drawHeaderRow($skill, 1, 'Edit', 'skill_add_edit.php?id=' . url_id());
} else {
    echo drawHeaderRow($skill, 1);
}
if ($users = db_table('SELECT 
		u.userID, 
		u.firstName,
		u.lastName 
	FROM users_to_skills u2s 
	JOIN intranet_users u ON u2s.user_id = u.userID
	WHERE u2s.skill_id = ' . url_id() . ' AND u.isActive = 1
	ORDER BY u.lastName, u.firstName')) {
    ?>
	<tr>
		<th>User</th>
	</tr>
	<?php 
    foreach ($users as $u) {
        echo '<tr>
			<td><a href="view.php?id=' . $u['userID'] . '">' . $u['firstName'] . ' ' . $u['lastName'] . '</a></td>
		</tr>';
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:31,代码来源:skill.php

示例9: drawTop

<?php

include "../../include.php";
echo drawTop();
$r = db_grab("SELECT programDesc FROM funders_programs WHERE programID = " . $_GET["id"]);
?>

<table class="left" cellspacing="1">
	<?php 
echo drawHeaderRow($r, 2);
?>
	<tr>
		<td class="left">Name</td>
		<td><b><?php 
echo $r;
?>
</b></td>
	</tr>
	<tr>
		<td class="bottom" colspan="2"><?php 
echo draw_form_button("edit name", "program_add_edit.php?id=" . $_GET["id"]);
?>
</td>
	</tr>
</table>

<table class="left" cellspacing="1">
	<tr>
		<td colspan="5" class="head">
			Funders Interesed in <?php 
echo $r;
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:program.php

示例10: db_grab

$r = db_grab('SELECT 
		u.firstname,
		u.lastname,
		u.nickname, 
		u.bio' . langExt() . ' bio, 
		u.email,
		' . db_pwdcompare("", "u.password") . ' password,
		u.phone, 
		u.lastlogin, 
		u.title' . langExt() . ' title,
		f.name office, 
		u.officeID,
		d.departmentName,
		u.organization_id,
		o.title' . langExt() . ' organization,
		u.homeAddress1,
		u.homeAddress2,
		u.homeCity,
		s.stateAbbrev,
		u.homeZIP,
		c.title' . langExt() . ' channel,
		u.homePhone,
		u.homeCell,
		u.homeEmail,
		u.emerCont1Name,
		u.emerCont1Relationship,
		u.emerCont1Phone,
		u.emerCont1Cell,
		u.emerCont1Email,
		u.emerCont2Name,
		u.emerCont2Relationship,
		u.emerCont2Phone,
		u.emerCont2Cell,
		u.emerCont2Email,
		u.startDate,
		u.longDistanceCode,
		u.endDate,
		u.is_active,
		u.is_admin,
		r.description rank,
		l.title language,
		' . db_updated('u') . '
	FROM users u
	JOIN languages l ON u.language_id = l.id
	LEFT JOIN users_to_channels u2c ON u.id = u2c.user_id
	LEFT JOIN channels			c ON u2c.channel_id = c.id
	LEFT JOIN intranet_ranks	r ON u.rankID = r.id
	LEFT JOIN organizations		o ON u.organization_id = o.id
	LEFT JOIN departments		d ON d.departmentID	= u.departmentID 				
	LEFT JOIN offices    		f ON f.id			= u.officeID 				
	LEFT JOIN intranet_us_states		s ON u.homeStateID	= s.stateID
	WHERE u.id = ' . $_GET['id']);
开发者ID:Rhenan,项目名称:intranet-1,代码行数:52,代码来源:view.php

示例11: url_query_add

<?php

include 'include.php';
if (!url_id()) {
    url_query_add(array('id' => 1));
}
drawTop();
$locations = db_query("SELECT \n\t\to.id, \n\t\to.name\n\tFROM intranet_offices o \n\tORDER BY (SELECT COUNT(*) FROM intranet_users u WHERE u.officeID = o.id) DESC");
if (db_found($locations)) {
    $pages = array();
    while ($l = db_fetch($locations)) {
        $pages["/staff/locations.php?id=" . $l["id"]] = $l["name"];
    }
    echo drawNavigationRow($pages, $location, true);
}
if ($_GET["id"] == "other") {
    echo drawStaffList("u.isactive = 1 AND u.officeID <> 1 AND u.officeID <> 6 AND u.officeID <> 11 AND u.officeID <> 9");
} else {
    $l = db_grab('SELECT name, address FROM intranet_offices WHERE id = ' . $_GET['id']);
    if (!empty($l['address'])) {
        echo drawServerMessage('<center><strong>' . $l['name'] . ' Office</strong><br>' . nl2br($l['address']) . '</center>');
    }
    echo drawStaffList("u.isactive = 1 and u.officeID = " . $_GET["id"]);
}
drawBottom();
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:25,代码来源:locations.php

示例12: drawTop

<?php

include '../include.php';
echo drawTop();
if (url_action('delete')) {
    db_delete('external_orgs');
    url_change('./');
}
if (url_id()) {
    echo drawTableStart();
    echo drawHeaderRow($page['breadcrumbs'] . $page['title'], 2, getString('edit'), 'edit/?id=' . $_GET['id'], getString('delete'), drawDeleteLink());
    $r = db_grab('SELECT e.title' . langExt() . ' title, e.url, e.description' . langExt() . ' description FROM external_orgs e WHERE e.id = ' . $_GET['id']);
    ?>
	<tr>
		<td class="left"><?php 
    echo getString('title');
    ?>
</td>
		<td class='title'><?php 
    echo draw_link($r['url'], $r['title']);
    ?>
</td>
	</tr>
	<tr>
		<td class="left"><?php 
    echo getString('description');
    ?>
</td>
		<td class="text"><?php 
    echo $r['description'];
    ?>
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:index.php

示例13: error_debug

if ($posting) {
    error_debug('user is posting', __FILE__, __LINE__);
    if ($uploading) {
        list($_POST['content'], $_POST['type_id']) = file_get_uploaded('content', 'docs_types');
    }
    langTranslatePost('title,description');
    $id = db_save('docs');
    //debug();
    db_checkboxes('categories', 'docs_to_categories', 'documentID', 'categoryID', $id);
    if (getOption('channels')) {
        db_checkboxes('channels', 'docs_to_channels', 'doc_id', 'channel_id', $id);
    }
    url_change('info.php?id=' . $id);
}
if (url_id()) {
    $d = db_grab('SELECT title, description FROM docs WHERE id = ' . $_GET['id']);
    $pageAction = getString('edit');
} else {
    $pageAction = getString('add_new');
}
echo drawTop();
//load code for JS
$extensions = array();
$doctypes = array();
$types = db_query('SELECT description, extension FROM docs_types ORDER BY description');
while ($t = db_fetch($types)) {
    $extensions[] = '(extension != "' . $t['extension'] . '")';
    $doctypes[] = ' - ' . $t['description'] . ' (.' . $t['extension'] . ')';
}
?>
<script language='javascript'>
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:edit.php

示例14: drawTop

<?php

include "../include.php";
echo drawTop();
if (url_id()) {
    $title = db_grab('SELECT title' . langExt() . ' title FROM press_clips_types WHERE id = ' . $_GET["id"]);
    $result = db_table('SELECT c.id, c.title' . langExt() . ' title, c.pub_date, c.publication' . langExt() . ' publication, ISNULL(c.created_date, c.updated_date) updated FROM press_clips c ' . getChannelsWhere('press_clips', 'c', 'clip_id') . ' AND c.type_id = ' . $_GET["id"] . ' ORDER BY updated DESC');
    $t = new table('press_clips', drawHeader(false, $title));
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('publication', 'l', getString('publication'));
    $t->set_column('pub_date', 'r', getString('published'));
    foreach ($result as &$r) {
        $r['title'] = draw_link('clip.php?id=' . $r['id'], format_string($r['title'], 50));
        $r['pub_date'] = format_date($r['pub_date']);
    }
    echo $t->draw($result, 'There are no clips tagged <i>' . $title . '</i>.');
} else {
    $t = new table('press_clips', drawHeader());
    $t->set_column('category', 'l', getString('category'));
    $t->set_column('clips', 'r', getString('clips'));
    $result = db_table('SELECT t.id, t.title' . langExt() . ' category, (SELECT COUNT(*) FROM press_clips c WHERE c.type_id = t.id) clips FROM press_clips_types t ORDER BY t.precedence');
    foreach ($result as &$r) {
        $r['category'] = draw_link(url_query_add(array('id' => $r['id']), false), $r['category']);
    }
    echo $t->draw($result);
}
echo drawBottom();
开发者ID:Rhenan,项目名称:intranet-1,代码行数:27,代码来源:categories.php

示例15: db_table

        $repliers = db_table("SELECT \n\t\t\t\tu.email,\n\t\t\t\tl.code\n\t\t\tFROM bb_followups f \n\t\t\tJOIN users u ON u.id = f.created_user \n\t\t\tJOIN languages l ON u.language_id = l.id\n\t\t\tWHERE u.is_active = 1 AND f.is_active = 1 AND f.topic_id = " . $_POST["topic_id"]);
        foreach ($repliers as $r) {
            $addresses[$r['code']][] = $r['email'];
        }
        foreach ($addresses as $lang => $emails) {
            $topic = db_grab('SELECT 
						t.title' . langExt($lang) . ' title, 
						y.title' . langExt($lang) . ' type,
						t.created_date
					FROM bb_topics t
					LEFT JOIN bb_topics_types y ON t.type_id = y.id
					WHERE t.id = ' . $_POST['topic_id']);
            $reply = db_grab('SELECT
						f.description' . langExt($lang) . ' description,
						ISNULL(u.nickname, u.firstname) firstname, 
						u.lastname
					FROM bb_followups f
					JOIN users u ON f.created_user = u.id
					WHERE f.id = ' . $id);
            $channels_text = db_array('SELECT c.title' . langExt($lang) . ' FROM bb_topics_to_channels t2c JOIN channels c ON t2c.channel_id = c.id WHERE t2c.topic_id = ' . $_POST['topic_id']);
            $channels_text = implode(', ', $channels_text);
            $message = '<p style="font-weight:bold;">' . $reply['firstname'] . ' ' . $reply['lastname'] . ' ' . getString('bb_followup', $lang) . '</p>
				<p>' . getString('title', $lang) . ': ' . draw_link(url_base() . '/bb/topic.php?id=' . $id, $topic['title']) . '</p>
				<p>' . getString('channels_label', $lang) . ': ' . $channels_text . '</p>';
            if ($topic['type']) {
                $message .= '<p>' . getString('category', $lang) . ': ' . $topic['type'] . '</p>';
            }
            $message .= '<div style="color:#555; border-top:1px dotted #555; padding-top:5px; margin-top:5px;">' . $reply['description'] . '</div>';
            emailUser($emails, 'RE: ' . $topic['title'], $message);
        }
    }
开发者ID:Rhenan,项目名称:intranet-1,代码行数:31,代码来源:topic.php


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