本文整理汇总了PHP中db_numrows函数的典型用法代码示例。如果您正苦于以下问题:PHP db_numrows函数的具体用法?PHP db_numrows怎么用?PHP db_numrows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_numrows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($label, $date)
{
echo "<td>{$label}</td>";
$datestr = date('j/m/y H:i', $date);
echo "<td>{$datestr}</td>";
$res = db_query("SELECT count(*) access FROM user WHERE last_access_date >= {$date}");
if (db_numrows($res)) {
$cntlast = db_result($res, 0, 'access');
}
echo "<td>{$cntlast}</td>";
$res = db_query("SELECT count(*) access FROM user WHERE last_access_date >= {$date} AND email LIKE '%@orange.com'");
if (db_numrows($res)) {
$cntft = db_result($res, 0, 'access');
}
$percentft = round($cntft * 100 / $cntlast, 2);
echo "<td>{$cntft} en @orange.com [{$percentft} %]</td>";
$res = db_query("SELECT count(*) access FROM user WHERE last_access_date >= {$date} AND email LIKE '%.ext@orange.com'");
if (db_numrows($res)) {
$cntext = db_result($res, 0, 'access');
}
$percentext = round($cntext * 100 / $cntlast, 2);
echo "<td>dont {$cntext} en .ext@orange.com [{$percentext} %]</td>";
$cntother = $cntlast - $cntft;
$percentother = round($cntother * 100 / $cntlast, 2);
echo "<td>et autres {$cntother} [{$percentother} %]</td>";
}
示例2: verify_login_valid
function verify_login_valid()
{
global $Language;
$request =& HTTPRequest::instance();
if (!$request->existAndNonEmpty('form_loginname')) {
$GLOBALS['Response']->addFeedback('error', $Language->getText('include_session', 'missing_pwd'));
return 0;
}
// first check just confirmation hash
$res = db_query('SELECT confirm_hash,status FROM user WHERE ' . 'user_name=\'' . db_es($request->get('form_loginname')) . '\'');
if (db_numrows($res) < 1) {
$GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_user'));
return 0;
}
$usr = db_fetch_array($res);
//if sys_user_approval=1 then check if the admin aldready validates the account
if ($GLOBALS['sys_user_approval'] == 0 || $usr['status'] == 'V' || $usr['status'] == 'W') {
if (strcmp($request->get('confirm_hash'), $usr['confirm_hash'])) {
$GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_hash'));
return 0;
}
} else {
$GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_status'));
return 0;
}
// then check valid login
return UserManager::instance()->login($request->get('form_loginname'), $request->get('form_pw'), true);
}
示例3: display
function display($data)
{
echo '<fieldset><legend style="font-size:1.2em;">Choose the template of the project</legend>';
include $GLOBALS['Language']->getContent('project/template');
$rows = db_numrows($this->db_templates);
if ($rows > 0) {
//echo '<h3>From templates</h3><blockquote>';
$GLOBALS['HTML']->box1_top($GLOBALS['Language']->getText('register_template', 'choose'));
print '
<TABLE width="100%">';
for ($i = 0; $i < $rows; $i++) {
$this->_displayProject(db_result($this->db_templates, $i, 'group_id'), db_result($this->db_templates, $i, 'group_name'), db_result($this->db_templates, $i, 'register_time'), db_result($this->db_templates, $i, 'unix_group_name'), db_result($this->db_templates, $i, 'short_description'));
}
print '</TABLE>';
$GLOBALS['HTML']->box1_bottom();
//echo '</blockquote>';
}
//{{{ Projects where current user is admin
$result = db_query("SELECT groups.group_name AS group_name, " . "groups.group_id AS group_id, " . "groups.unix_group_name AS unix_group_name, " . "groups.register_time AS register_time, " . "groups.short_description AS short_description " . "FROM groups, user_group " . "WHERE groups.group_id = user_group.group_id " . "AND user_group.user_id = '" . user_getid() . "' " . "AND user_group.admin_flags = 'A' " . "AND groups.status='A' ORDER BY group_name");
echo db_error($result);
$rows = db_numrows($result);
if ($result && $rows) {
include $GLOBALS['Language']->getContent('project/template_my');
echo '<br />';
$GLOBALS['HTML']->box1_top($GLOBALS['Language']->getText('register_template', 'choose_admin'));
print '<TABLE width="100%">';
for ($i = 0; $i < $rows; $i++) {
$this->_displayProject(db_result($result, $i, 'group_id'), db_result($result, $i, 'group_name'), db_result($result, $i, 'register_time'), db_result($result, $i, 'unix_group_name'), db_result($result, $i, 'short_description'));
}
print '</TABLE>';
$GLOBALS['HTML']->box1_bottom();
}
//}}}
echo '</fieldset>';
}
示例4: getContent
function getContent()
{
$html_my_bookmarks = '';
$result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where " . "user_id='" . user_getid() . "' ORDER BY bookmark_title");
$rows = db_numrows($result);
if (!$result || $rows < 1) {
$html_my_bookmarks .= $GLOBALS['Language']->getText('my_index', 'no_bookmark');
$html_my_bookmarks .= db_error();
} else {
$purifier = Codendi_HTMLPurifier::instance();
$html_my_bookmarks .= '<table style="width:100%">';
for ($i = 0; $i < $rows; $i++) {
$bookmark_url = $purifier->purify(db_result($result, $i, 'bookmark_url'), CODENDI_PURIFIER_CONVERT_HTML);
if (my_has_URL_invalid_content($bookmark_url)) {
$bookmark_url = '';
}
$bookmark_title = $purifier->purify(db_result($result, $i, 'bookmark_title'), CODENDI_PURIFIER_CONVERT_HTML);
$html_my_bookmarks .= '<TR class="' . util_get_alt_row_color($i) . '"><TD>';
$html_my_bookmarks .= '<A HREF="' . $bookmark_url . '">' . $bookmark_title . '</A> ';
$html_my_bookmarks .= '<small><A HREF="/my/bookmark_edit.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">[' . $GLOBALS['Language']->getText('my_index', 'edit_link') . ']</A></SMALL></TD>';
$html_my_bookmarks .= '<td style="text-align:right"><A HREF="/my/bookmark_delete.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">';
$html_my_bookmarks .= '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="DELETE"></A></td></tr>';
}
$html_my_bookmarks .= '</table>';
}
$html_my_bookmarks .= '<div style="text-align:center; font-size:0.8em;"><a href="/my/bookmark_add.php">[' . $GLOBALS['Language']->getText('my_index', 'add_bookmark') . ']</a></div>';
return $html_my_bookmarks;
}
示例5: forum_show_nested_messages
function forum_show_nested_messages($thread_id, $msg_id)
{
global $total_rows, $Language;
$sql = "SELECT user.user_name,forum.has_followups,user.realname,user.user_id,forum.msg_id,forum.group_forum_id,forum.subject,forum.thread_id,forum.body,forum.date,forum.is_followup_to, forum_group_list.group_id " . "FROM forum,user,forum_group_list WHERE forum.thread_id=" . db_ei($thread_id) . " AND user.user_id=forum.posted_by AND forum.is_followup_to=" . db_ei($msg_id) . " AND forum_group_list.group_forum_id = forum.group_forum_id " . "ORDER BY forum.date ASC;";
$result = db_query($sql);
$rows = db_numrows($result);
$ret_val = '';
if ($result && $rows > 0) {
$ret_val .= '
<UL>';
/*
iterate and show the messages in this result
for each message, recurse to show any submessages
*/
for ($i = 0; $i < $rows; $i++) {
// increment the global total count
$total_rows++;
// show the actual nested message
$ret_val .= forum_show_a_nested_message($result, $i) . '<P>';
if (db_result($result, $i, 'has_followups') > 0) {
// Call yourself if there are followups
$ret_val .= forum_show_nested_messages($thread_id, db_result($result, $i, 'msg_id'));
}
}
$ret_val .= '
</UL>';
}
return $ret_val;
}
示例6: fetchDatas
/**
* Fill the arrays $this->source_refs_datas and $this->target_refs_datas
* for the current CrossReferenceFactory
*/
function fetchDatas()
{
$sql = "SELECT * \n FROM cross_references \n WHERE (target_gid=" . $this->entity_gid . " AND target_id='" . $this->entity_id . "' AND target_type='" . $this->entity_type . "' ) \n OR (source_gid=" . $this->entity_gid . " AND source_id='" . $this->entity_id . "' AND source_type='" . $this->entity_type . "' )";
$res = db_query($sql);
if ($res && db_numrows($res) > 0) {
$this->source_refs_datas = array();
$this->target_refs_datas = array();
while ($field_array = db_fetch_array($res)) {
$target_id = $field_array['target_id'];
$target_gid = $field_array['target_gid'];
$target_type = $field_array['target_type'];
$target_key = $field_array['target_keyword'];
$source_id = $field_array['source_id'];
$source_gid = $field_array['source_gid'];
$source_type = $field_array['source_type'];
$source_key = $field_array['source_keyword'];
$user_id = $field_array['user_id'];
$created_at = $field_array['created_at'];
if ($target_id == $this->entity_id && $target_gid == $this->entity_gid && $target_type == $this->entity_type) {
$this->source_refs_datas[] = new CrossReference($source_id, $source_gid, $source_type, $source_key, $target_id, $target_gid, $target_type, $target_key, $user_id);
}
if ($source_id == $this->entity_id && $source_gid == $this->entity_gid && $source_type == $this->entity_type) {
$this->target_refs_datas[] = new CrossReference($source_id, $source_gid, $source_type, $source_key, $target_id, $target_gid, $target_type, $target_key, $user_id);
}
}
}
}
示例7: session_login_valid
/**
return data:
$array[success]=true;
$array[session_hash]=jkjkjkjkjkjkjkj;
$array[subprojects]=array(
55=>'Subproject 1',
77=>'Subproject2'
);
**OR**
$array[success]=false;
$array[errormessage]='Bad Password';
*/
function &MSPLogin($username, $password)
{
global $feedback, $session_ser, $sys_database_type;
$success = session_login_valid(strtolower($username), $password);
if ($success) {
$array['success'] = true;
$array['session_hash'] = $session_ser;
if ($sys_database_type == "mysql") {
$sql = "SELECT pgl.group_project_id, CONCAT(g.group_name, ': ', pgl.project_name) AS name";
} else {
$sql = "SELECT pgl.group_project_id, g.group_name || ': ' || pgl.project_name AS name";
}
$sql .= "\n\t\t\tFROM groups g, project_group_list pgl, role_setting rs, user_group ug\n\t\t\tWHERE ug.user_id='" . user_getid() . "' \n\t\t\tAND g.group_id=pgl.group_id\n\t\t\tAND rs.value::integer > 0\n\t\t\tAND rs.group_project_id = pgl.group_project_id\n AND ug.role_id = rs.role_id\n AND rs.section_name='pm'";
$res = db_query($sql);
$rows = db_numrows($res);
if (!$res || $rows < 1) {
$array['success'] = false;
$array['errormessage'] = 'No Subprojects Found';
} else {
for ($i = 0; $i < $rows; $i++) {
$array['subprojects'][db_result($res, $i, 'group_project_id')] = db_result($res, $i, 'name');
}
}
} else {
$array['success'] = false;
$array['errormessage'] = $feedback;
}
printr($array, 'MSPLogin::return-array');
return $array;
}
示例8: getContent
public function getContent()
{
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
if (db_numrows($res_admin) > 0) {
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$em = EventManager::instance();
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
while ($row_admin = db_fetch_array($res_admin)) {
$display_name = '';
$em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
if (!$display_name) {
$display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
}
echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
}
}
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
// count of developers on this project
$res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
echo db_numrows($res_count);
echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
}
示例9: loadContent
function loadContent($id)
{
$this->content_id = $id;
$sql = "SELECT * FROM plugin_hudson_widget WHERE widget_name='" . $this->widget_id . "' AND owner_id = " . $this->owner_id . " AND owner_type = '" . $this->owner_type . "' AND id = " . $id;
$res = db_query($sql);
if ($res && db_numrows($res)) {
$data = db_fetch_array($res);
$this->job_id = $data['job_id'];
$jobs = $this->getAvailableJobs();
if (array_key_exists($this->job_id, $jobs)) {
try {
$used_job = $jobs[$this->job_id];
$this->job_url = $used_job->getUrl();
$this->job = $used_job;
$this->last_build_url = $this->job_url . '/lastBuild/';
$this->build = new HudsonBuild($this->last_build_url);
} catch (Exception $e) {
$this->job = null;
$this->build = null;
}
} else {
$this->job = null;
$this->build = null;
}
}
}
示例10: session_require
function session_require($req)
{
global $Language;
/*
Codendi admins always return true
*/
if (user_is_super_user()) {
return true;
}
if (isset($req['group']) && $req['group']) {
$query = "SELECT user_id FROM user_group WHERE user_id=" . user_getid() . " AND group_id=" . db_ei($req['group']);
if (isset($req['admin_flags']) && $req['admin_flags']) {
$query .= " AND admin_flags = '" . db_escape_string($req['admin_flags']) . "'";
}
if (db_numrows(db_query($query)) < 1 || !$req['group']) {
exit_error($Language->getText('include_session', 'insufficient_g_access'), $Language->getText('include_session', 'no_perm_to_view'));
}
} elseif (isset($req['user']) && $req['user']) {
if (user_getid() != $req['user']) {
exit_error($Language->getText('include_session', 'insufficient_u_access'), $Language->getText('include_session', 'no_perm_to_view'));
}
} elseif (isset($req['isloggedin']) && $req['isloggedin']) {
if (!user_isloggedin()) {
exit_error($Language->getText('include_session', 'required_login'), $Language->getText('include_session', 'login'));
}
} else {
exit_error($Language->getText('include_session', 'insufficient_access'), $Language->getText('include_session', 'no_access'));
}
}
示例11: reports_quick_graph
/**
* reports_quick_graph() - Show a quick graph of data.
*
* @param string Graph title
* @param int First query resource ID
* @param int Second query resource ID
* @param string The bar colors
*/
function reports_quick_graph($title, $sql1, $sql2, $bar_colors)
{
$result1 = db_query($sql1);
$result2 = db_query($sql2);
if ($result1 && $result2 && db_numrows($result2) > 0) {
$assoc_open = util_result_columns_to_assoc($result1);
$assoc_all = util_result_columns_to_assoc($result2);
while (list($key, $val) = each($assoc_all)) {
$titles[] = $key;
$all[] = $val;
if ($assoc_open[$key]) {
$open[] = $assoc_open[$key];
} else {
$open[] = 0;
}
}
/* for ($i=0; $i<db_numrows($result1); $i++) {
echo "$titles[$i]=>$opened[$i]/$all[$i]<br />";
}
*/
$scale = graph_calculate_scale(array($opened, $all), 400);
$props["scale"] = $scale;
$props["cellspacing"] = 5;
$props = hv_graph_defaults($props);
start_graph($props, $titles);
horizontal_multisection_graph($titles, array($open, $all), $bar_colors, $props);
end_graph();
print '<p /><br />';
print '<table cellspacing="0" border="0"><tr align="center"><td width="15%">' . _('Key') . ':</td><td width="5%">(</td><td width="35%" style="background-color:' . $bar_colors[0] . '">' . _('Open') . '</td>' . '<td width="5%">/</td><td width="35%" style="background-color:' . $bar_colors[1] . '">' . _('All') . ' </td><td width="5%">)</td></tr></table>';
print '<p />';
// GraphResult($result,$title);
} else {
echo "<h2>" . _('No data found to report') . "</h2>";
}
}
示例12: ArtifactFromID
function ArtifactFromID($id, $data = false)
{
if ($data) {
$art_arr =& $data;
} else {
$res = db_query("SELECT * FROM artifact_vw WHERE artifact_id='{$id}'");
if (!$res || db_numrows($res) < 1) {
$this->setError("Invalid Artifact ID");
return false;
} else {
$art_arr =& db_fetch_array($res);
}
}
$at = artifactType_get_object($art_arr['group_artifact_id']);
if (!$at || !is_object($at)) {
$this->setError("Could Not Create ArtifactType");
return false;
} elseif ($at->isError()) {
$this->setError($at->getErrorMessage());
return false;
}
$this->ArtifactType =& $at;
$a = artifact_get_object($id, $art_arr);
if (!$a || !is_object($a)) {
$this->setError("Could Not Create Artifact");
return false;
} elseif ($a->isError()) {
$this->setError($a->getErrorMessage());
return false;
}
$this->Artifact =& $a;
return true;
}
示例13: extractDataFromResult
protected function extractDataFromResult($res, $ids, $column)
{
$data = array();
if ($res && db_numrows($res)) {
db_reset_result($res);
while ($d = db_fetch_array($res)) {
if (!isset($data[$d['day']])) {
$data[$d['day']] = array();
foreach ($ids as $id) {
$data[$d['day']][$id] = 0;
}
}
$data[$d['day']][$d['id']] += $d[$column];
}
ksort($data);
$previous = array();
foreach ($data as $k => $d) {
if (count($previous)) {
foreach ($d as $id => $v) {
if ($v == 0 && $previous[$id]) {
$data[$k][$id] = $previous[$id];
}
}
}
$previous = $data[$k];
}
}
return $data;
}
示例14: getCommitEntries
/**
* It display a table with commit related to this tracker or task_extra_detail
*
* @param string $Query Query to be executed to get the commit entries.
* @param integer $group_id Group_id of the actual Group_id
*
*/
function getCommitEntries($Query, $group_id)
{
$group =& group_get_object($group_id);
if (!$group->usesPlugin($this->name)) {
return;
}
$DBResult = db_query($Query);
$Rows = db_numrows($DBResult);
if ($Rows > 0) {
echo '<tr><td colspan="2">';
echo '<h4>' . _('Links to related CVS commits') . ':</h4>';
$title_arr = $this->getTitleArr();
echo $GLOBALS['HTML']->listTableTop($title_arr);
for ($i = 0; $i < $Rows; $i++) {
$Row = db_fetch_array($DBResult);
echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '>' . '<td>' . $this->getFileLink($group->getUnixName(), $Row['file'], $Row['actual_version']) . '</td>' . '<td>' . date(_('Y-m-d'), $Row['cvs_date']) . '</td>' . '<td>' . $this->getDiffLink($group->getUnixName(), $Row['file'], $Row['prev_version'], $Row['actual_version']) . '</td>' . '<td>' . $this->getActualVersionLink($group->getUnixName(), $Row['file'], $Row['actual_version']) . '</td>
<td>' . htmlspecialchars($Row['log_text']) . '</td>
<td>' . util_make_link_u($Row['author'], user_get_object_by_name($Row['author'])->getId(), $Row['author']) . '</td>
</tr>';
}
echo $GLOBALS['HTML']->listTableBottom();
echo '</td></tr>';
} else {
echo '<h4>' . _('No commits have been made.') . '</h4>';
}
}
示例15: Widget_MySurveys
function Widget_MySurveys()
{
$this->Widget('mysurveys');
$no_survey = true;
// Get id and title of the survey that will be promoted to user page. default = survey whose id=1
if ($GLOBALS['sys_my_page_survey']) {
$developer_survey_id = $GLOBALS['sys_my_page_survey'];
} else {
$developer_survey_id = "1";
}
$survey = SurveySingleton::instance();
$sql = "SELECT * from surveys WHERE survey_id=" . db_ei($developer_survey_id);
$result = db_query($sql);
$group_id = db_result($result, 0, 'group_id');
$purifier = Codendi_HTMLPurifier::instance();
$survey_title = $purifier->purify($survey->getSurveyTitle(db_result($result, 0, 'survey_title')));
// Check that the survey is active
$devsurvey_is_active = db_result($result, 0, 'is_active');
if ($devsurvey_is_active == 1) {
$sql = "SELECT * FROM survey_responses " . "WHERE survey_id='" . db_ei($developer_survey_id) . "' AND user_id='" . db_ei(user_getid()) . "'";
$result = db_query($sql);
if (db_numrows($result) < 1) {
$no_survey = false;
$this->content .= '<a href="/survey/survey.php?group_id=' . $group_id . '&survey_id=' . $developer_survey_id . '">' . $survey_title . '</a>';
}
}
if ($no_survey) {
$this->content .= $GLOBALS['Language']->getText('my_index', 'no_survey');
}
}