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


PHP query2result函数代码示例

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


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

示例1: array

    $fields = array("headings" => array("View", "Author", "Subject", "Date", "Followup", "Status", "Priority", "Owner", "Link"), "columns" => array("ticket", "author", "subject", "timestamp", "activity", "type", "priority", "assignment", "ticket"), "types" => array("view", "email", "normal", "open_date", "activity_date", "normal", "priority_view", "user", "attach"), "aligns" => array("center", "left", "left", "left", "left", "center", "center", "center", "center"));
} else {
    $fields = array("headings" => array("View", "Author", "Subject", "Date", "Followup", "Status", "Priority", "Owner"), "columns" => array("ticket", "author", "subject", "timestamp", "activity", "type", "priority", "assignment"), "types" => array("view", "email", "normal", "open_date", "activity_date", "normal", "priority_view", "user"), "aligns" => array("center", "left", "left", "left", "left", "center", "center", "center"));
}
/* set up defaults for viewing */
if ($type == "my") {
    $title = "My Tickets";
} else {
    $title = "{$type} Tickets";
}
/* count tickets */
$query = "SELECT COUNT(*) FROM {$dbprefix}tickets WHERE parent = '0'";
if ($type != 'All') {
    $query .= " AND type = '{$type}'";
}
$ticket_count = query2result($query);
/* paging controls */
if ($offset + $limit < $ticket_count) {
    $page_string = $offset + 1 . " to " . ($offset + $limit) . " of {$ticket_count}";
} else {
    $page_string = $offset + 1 . " to {$ticket_count} of {$ticket_count}";
}
/* start table */
?>

<table class="tbl" width="100%">
<tr>
	<td colspan="<?php 
echo count($fields["headings"]);
?>
" align="center">
开发者ID:srinivasulurao,项目名称:jonel,代码行数:31,代码来源:index.php

示例2: format_field

print "<input type=\"hidden\" name=\"author\" value='" . $ticket_info["author"] . "' />\n";
print "<input type=\"hidden\" name=\"priority\" value='" . $ticket_info["priority"] . "' />\n";
print "<input type=\"hidden\" name=\"subject\" value='" . $ticket_info["subject"] . "' />\n";
/* output ticket */
for ($loop = 0; $loop < count($fields["headings"]); $loop++) {
    print "<tr>\n";
    if ($fields["headings"][$loop] !== "<br />") {
        $fields["headings"][$loop] = $AppUI->_($fields["headings"][$loop]);
    }
    print "<td align=\"right\">" . $fields["headings"][$loop] . "</td>";
    print "<td align=\"left\" class=\"hilite\">" . format_field($ticket_info[$fields["columns"][$loop]], $fields["types"][$loop]) . "</td>\n";
    print "</tr>\n";
}
$ticket_info["assignment"];
/* output attachment indicator */
$attach_count = query2result("SELECT attachment FROM tickets WHERE ticket = '{$ticket}'");
if ($attach_count == 1) {
    print "<tr>\n";
    print "<td align=\"left\"><strong>Attachments</strong></td>";
    print "<td align=\"left\">This email had attachments which were removed.</td>\n";
    print "</tr>\n";
} else {
    if ($attach_count == 2) {
        $result = do_query("SELECT file_id, file_name from files, tickets where ticket = '{$ticket}'\n  and file_task = ticket and file_project = 0");
        if (number_rows($result)) {
            print "<tr>\n";
            print "<td align=\"left\"><b>Attachments</b></td>";
            print "<td align=\"left\">";
            while ($row = result2hash($result)) {
                echo "<a href='fileviewer.php?file_id=" . $row["file_id"] . "'>";
                echo $row["file_name"];
开发者ID:hightechcompany,项目名称:dotproject,代码行数:31,代码来源:view.php

示例3: format_field

function format_field($value, $type, $ticket = NULL)
{
    global $CONFIG;
    global $AppUI;
    global $canEdit;
    switch ($type) {
        case "user":
            if ($value) {
                $output = query2result("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$value}'");
            } else {
                $output = "-";
            }
            break;
        case "status":
            if ($canEdit) {
                $output = create_selectbox("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
            } else {
                $output = chooseSelectedValue("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
            }
            break;
        case "priority_view":
            $priority = $CONFIG["priority_names"][$value];
            $color = $CONFIG["priority_colors"][$value];
            if ($value == 3) {
                $priority = "<strong>{$priority}</strong>";
            }
            if ($value == 4) {
                $priority = "<blink><strong>{$priority}</strong></blink>";
            }
            $output = "<font color=\"{$color}\">{$priority}</font>";
            break;
        case "priority_select":
            if ($canEdit) {
                $output = create_selectbox("priority_toggle", $CONFIG["priority_names"], $value);
            } else {
                $output = chooseSelectedValue("priority_toggle", $CONFIG["priority_names"], $value);
            }
            break;
        case "assignment":
            $options[0] = "-";
            $query = "SELECT user_id as id, CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id ORDER BY name";
            $result = do_query($query);
            while ($row = result2hash($result)) {
                $options[$row["id"]] = $row["name"];
            }
            if ($canEdit) {
                $output = create_selectbox("assignment_toggle", $options, $value);
            } else {
                $output = chooseSelectedValue("assignment_toggle", $options, $value);
            }
            break;
        case "view":
            if ($CONFIG["index_link"] == "latest") {
                $latest_value = query2result("SELECT ticket FROM tickets WHERE parent = '{$value}' ORDER BY ticket DESC LIMIT 1");
                if ($latest_value) {
                    $value = $latest_value;
                }
            }
            $output = "<a href=index.php?m=ticketsmith&a=view&ticket={$value}>{$value}&nbsp;";
            $output .= "<img src=images/icons/pencil.gif border=0></a>";
            break;
        case "attach":
            $output = "<A href=index.php?m=ticketsmith&a=attach&ticket={$value}>";
            $output .= "Link</a>";
            break;
        case "doattach":
            $output = "<A href=index.php?m=ticketsmith&a=attach&newparent={$value}&dosql=reattachticket&ticket={$ticket}>";
            $output .= "Link</a>";
            break;
        case "open_date":
            $output = get_time_ago($value);
            if ($CONFIG["warning_active"]) {
                if (time() - $value > $CONFIG["warning_age"] * 3600) {
                    $output = "<font color=\"" . $CONFIG["warning_color"] . "\"><xb>" . $output . "</strong></font>";
                }
            }
            break;
        case "activity_date":
            if (!$value) {
                $output = "<em>" . $AppUI->_('none') . "</em>";
            } else {
                $output = get_time_ago($value);
            }
            $latest_followup_type = query2result("SELECT type FROM tickets WHERE parent = '{$ticket}' ORDER BY timestamp DESC LIMIT 1");
            if ($latest_followup_type) {
                $latest_followup_type = preg_replace("/(\\w+)\\s.*/", "\\1", $latest_followup_type);
                $output .= " [{$latest_followup_type}]";
            }
            break;
        case "elapsed_date":
            $output = date($CONFIG["date_format"], $value);
            $time_ago = get_time_ago($value);
            $output .= " <em>({$time_ago})</em>";
            break;
        case "body":
            if ($CONFIG["wordwrap"]) {
                $value = word_wrap($value, 78);
            }
            $value = htmlspecialchars($value);
            $output = "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\">\n";
//.........这里部分代码省略.........
开发者ID:hightechcompany,项目名称:dotproject,代码行数:101,代码来源:common.inc.php

示例4: query2hash

 print "</th>\n";
 print "</tr>\n";
 /* start form */
 print "<form name='ticketform' action=\"index.php?m=ticketsmith&a=followup&ticket={$ticket}\" method=post>\n";
 /* get ticket */
 $ticket_info = query2hash("SELECT * FROM tickets WHERE ticket = {$ticket}");
 /* output From: line */
 print "<tr>\n";
 print "<td align=left><strong>" . $AppUI->_('From') . "</strong></td>";
 list($from_name, $from_email) = query2array("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name, contact_email as email FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$AppUI->user_id}'");
 print "<td align=left>" . $from_name . " &lt;" . $from_email . "&gt;</td>\n";
 print "</tr>\n";
 /* output To: line */
 print "<tr>\n";
 print "<td align=left><strong>" . $AppUI->_('To') . "</strong></td>";
 $recipient = query2result("SELECT author FROM tickets WHERE ticket = '{$ticket_parent}'");
 print "<td align=left>" . format_field($recipient, "recipient") . "</td>\n";
 print "</tr>\n";
 /* output ticket */
 for ($loop = 0; $loop < count($fields["headings"]); $loop++) {
     print "<tr>\n";
     // do not translate if heading is "<br />"
     if ($fields["headings"][$loop] == "<br />") {
     } else {
         $fields["headings"][$loop] = $AppUI->_($fields["headings"][$loop]);
     }
     print "<td align=left><strong>" . $fields["headings"][$loop] . "</strong></td>";
     print "<td align=left>" . format_field($ticket_info[$fields["columns"][$loop]], $fields["types"][$loop]) . "</td>\n";
     print "</tr>\n";
 }
 /* output submit button */
开发者ID:magsilva,项目名称:dotproject,代码行数:31,代码来源:followup.php

示例5: dPgetParam

require DP_BASE_DIR . '/modules/ticketsmith/config.inc.php';
require DP_BASE_DIR . '/modules/ticketsmith/common.inc.php';
/* set title */
$title = "Post Comment";
/* prepare ticket parent */
if (!$ticket_parent) {
    $ticket_parent = $ticket;
}
$author_name = dPgetParam($_POST, 'author_name', '');
$author_email = dPgetParam($_POST, 'author_email', '');
$comment = dPgetParam($_POST, 'comment', '');
$body = dPgetParam($_POST, 'body', '');
if (@$comment) {
    /* prepare fields */
    list($author_name, $author_email) = query2array("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name, contact_email as email FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$AppUI->user_id}'");
    $subject = db_escape(query2result("SELECT subject FROM tickets WHERE ticket = '{$ticket_parent}'"));
    $comment = db_escape($comment);
    $author = $author_name . " <" . $author_email . ">";
    $timestamp = time();
    $body = escape_string($body);
    /* prepare query */
    $query = "INSERT INTO tickets (author, subject, body, timestamp, type, parent, assignment) ";
    $query .= "VALUES ('{$author}','{$subject}','{$comment}','{$timestamp}','Staff Comment','{$ticket_parent}','9999')";
    /* insert comment */
    do_query($query);
    /* update parent ticket's timestamp */
    do_query("UPDATE tickets SET activity = '{$timestamp}' WHERE ticket = '{$ticket_parent}'");
    /* return to ticket view */
    echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=index.php?m=ticketsmith&a=view&ticket={$ticket_parent}\">";
    exit;
} else {
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:comment.php

示例6: while

    } else {
        $new_direction = $direction == 'ASC' ? 'DESC' : 'ASC';
    }
    echo '<th align="' . $fields['aligns'][$n] . '" style="padding: 4px">';
    echo '<a href="index.php?m=ticketsmith&type=' . $type . '&column=' . $fields['columns'][$n] . '&direction=' . $new_direction . '">';
    echo $AppUI->_($fields['headings'][$n]) . '</a></th>';
}
echo '</tr>';
/* output tickets */
if ($parent_count) {
    global $CONFIG;
    $nticks = 1;
    while ($row = result2hash($result)) {
        $value = $row['ticket'];
        if ($CONFIG['index_link'] == 'latest') {
            $latest_value = query2result("SELECT ticket FROM tickets WHERE parent = '{$value}' ORDER BY ticket DESC LIMIT 1");
            if ($latest_value) {
                $value = $latest_value;
            }
        }
        $action = "location.href = 'index.php?m=ticketsmith&a=view&ticket={$value}'";
        echo '<tr class="' . ($nticks % 2 == 1 ? 'first' : 'second') . '" onclick="' . $action . '" style="cursor:pointer">';
        echo '<td align="center"><img src="images/view.gif"></td>';
        for ($n = 1; $n < count($fields['headings']); $n++) {
            echo '<td align=' . $fields['aligns'][$n] . '>';
            //translate some information, some not
            if ($fields['headings'][$n] == 'Status') {
                echo $AppUI->_(format_field($row[$fields['columns'][$n]], $fields['types'][$n], $row[$fields['columns'][0]]));
            } else {
                echo format_field($row[$fields['columns'][$n]], $fields['types'][$n], $row[$fields['columns'][0]]);
            }
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:index.php


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