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


PHP perform_query函数代码示例

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


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

示例1: echoPage

function echoPage($page, $limit)
{
    $dbLink = db_connect_syslog(DBUSER, DBUSERPW);
    if ($limit <= 10) {
        echo " <a href='wres.php?page={$page}&limit=" . ($limit + 10) . "' class='load_more'></a\t";
        $sqllimit = "0,{$limit}";
    } else {
        $sqllimit = "10,{$limit}";
    }
    echo "<div style=\"width: 310px; margin-bottom: 5px; margin-left: 5px; text-align: center; font-size: 5px;\">";
    echo " <table> ";
    if ($page == "tail") {
        if ($limit <= 10) {
            echo "\n\t\t\t   \t<td class=\"wapresultsheader\">HOST</td>\n\t\t\t   \t<td class=\"wapresultsheader\">TIME</td>\n\t\t\t   \t<td class=\"wapresultsheader\">MESSAGE</td>\n\t\t\t   \t";
        }
        $query = "SELECT * FROM logs JOIN (select seq from logs FORCE INDEX(PRIMARY) ORDER BY seq DESC LIMIT {$sqllimit}) as sub USING(seq)";
    }
    if ($page == "topx") {
        if ($limit <= 10) {
            echo "\n\t\t\t   \t<td class=\"wapresultsheader\">HOST</td>\n\t\t\t   \t<td class=\"wapresultsheader\">COUNT</td>\n\t\t\t   \t<td class=\"wapresultsheader\">MESSAGE</td>\n\t\t\t   \t";
        }
        if (defined('SQZ_ENABLED') && SQZ_ENABLED == TRUE) {
            $query = "SELECT host,counter as count,msg from logs WHERE counter>1 ORDER BY counter DESC LIMIT {$sqllimit}";
        } else {
            $query = "SELECT host,count(*) as count,msg from logs GROUP BY host ORDER BY count DESC LIMIT {$sqllimit}";
        }
    }
    $results = perform_query($query, $dbLink);
    $color = "waplighter";
    $today = date('Y-m-d');
    while ($row = fetch_array($results)) {
        if ($color == "wapdarker") {
            $color = "waplighter";
        } else {
            $color = "wapdarker";
        }
        echo "<tr class=\"{$color}\">";
        echo "<td>" . $row['host'] . "</td>";
        if ($page == "tail") {
            $pieces = explode(" ", $row['datetime']);
            echo '<td>';
            if ($pieces[0] != $today) {
                echo $pieces[0] . "&nbsp;";
            }
            echo $pieces[1];
        }
        if ($page == "topx") {
            echo '<td>';
            echo $row['count'] . "&nbsp;";
        }
        echo "</td>\n";
        $row['msg'] = preg_replace('/\\s:/', ':', $row['msg']);
        $row['msg'] = preg_replace('/.*(%.*?:.*)/', '$1', $row['msg']);
        $msg = htmlspecialchars($row['msg']);
        echo "<td>";
        echo "{$msg}</td>\n";
        echo "</tr>\n";
    }
    echo "</div>\n";
}
开发者ID:jeroenrnl,项目名称:php-syslog-ng,代码行数:60,代码来源:wres.php

示例2: load_canned_messages

function load_canned_messages($locale, $groupid)
{
    global $mysqlprefix;
    $link = connect();
    $query = "select id, vcvalue from {$mysqlprefix}chatresponses " . "where locale = '" . $locale . "' AND (" . ($groupid ? "groupid = {$groupid}" : "groupid is NULL OR groupid = 0") . ") order by vcvalue";
    $result = select_multi_assoc($query, $link);
    if (!$groupid && count($result) == 0) {
        foreach (explode("\n", getstring_('chat.predefined_answers', $locale)) as $answer) {
            $result[] = array('id' => '', 'vcvalue' => $answer);
        }
        if (count($result) > 0) {
            $updatequery = "insert into {$mysqlprefix}chatresponses (vcvalue,locale,groupid) values ";
            for ($i = 0; $i < count($result); $i++) {
                if ($i > 0) {
                    $updatequery .= ", ";
                }
                $updatequery .= "('" . mysql_real_escape_string($result[$i]['vcvalue'], $link) . "','{$locale}', NULL)";
            }
            perform_query($updatequery, $link);
            $result = select_multi_assoc($query, $link);
        }
    }
    mysql_close($link);
    return $result;
}
开发者ID:laiello,项目名称:cartonbank,代码行数:25,代码来源:canned.php

示例3: create_table

function create_table($id, $link)
{
    global $dbtables, $memtables, $dbencoding, $mysqlprefix;
    if (!isset($dbtables[$id])) {
        show_install_err("Unknown table: {$id}, " . mysql_error($link));
    }
    $query = "CREATE TABLE {$id}\n" . "(\n";
    foreach ($dbtables[$id] as $k => $v) {
        $query .= "\t{$k} {$v},\n";
    }
    $query = preg_replace("/,\n\$/", "", $query);
    $query .= ") charset {$dbencoding}";
    if (in_array($id, $memtables)) {
        $query .= " ENGINE=MEMORY";
    } else {
        $query .= " ENGINE=InnoDb";
    }
    mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
    if ($id == "{$mysqlprefix}chatoperator") {
        create_operator_("admin", "", "", "Administrator", "Administrator", "", $link);
    } else {
        if ($id == "{$mysqlprefix}chatrevision") {
            perform_query("INSERT INTO {$mysqlprefix}chatrevision VALUES (1)", $link);
        }
    }
}
开发者ID:laiello,项目名称:cartonbank,代码行数:26,代码来源:dbinfo.php

示例4: add_message

function add_message($locale, $groupid, $message)
{
    global $mysqlprefix;
    $link = connect();
    perform_query("insert into {$mysqlprefix}chatresponses (locale,groupid,vcvalue) values ('" . mysql_real_escape_string($locale, $link) . "'," . ($groupid ? intval($groupid) . ", " : "null, ") . "'" . mysql_real_escape_string($message, $link) . "')", $link);
    mysql_close($link);
}
开发者ID:kuell,项目名称:chat,代码行数:7,代码来源:cannededit.php

示例5: update_operator_permissions

function update_operator_permissions($operatorid, $newvalue)
{
    global $mysqlprefix;
    $link = connect();
    $query = "update {$mysqlprefix}chatoperator set iperm = {$newvalue} where operatorid = {$operatorid}";
    perform_query($query, $link);
    mysql_close($link);
}
开发者ID:paulcn,项目名称:mibew,代码行数:8,代码来源:permissions.php

示例6: update_group

function update_group($groupid, $name, $descr, $commonname, $commondescr, $email)
{
    global $mysqlprefix;
    $link = connect();
    $query = sprintf("update {$mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s', vcemail = '%s' where groupid = %s", mysql_real_escape_string($name), mysql_real_escape_string($descr), mysql_real_escape_string($commonname), mysql_real_escape_string($commondescr), mysql_real_escape_string($email), $groupid);
    perform_query($query, $link);
    mysql_close($link);
}
开发者ID:laiello,项目名称:cartonbank,代码行数:8,代码来源:group.php

示例7: update_operator_permissions

function update_operator_permissions($operatorid, $newvalue)
{
    global $mysqlprefix;
    $link = connect();
    $query = sprintf("update {$mysqlprefix}chatoperator set iperm = %s where operatorid = %s", intval($newvalue), intval($operatorid));
    perform_query($query, $link);
    mysql_close($link);
}
开发者ID:kuell,项目名称:chat,代码行数:8,代码来源:permissions.php

示例8: update_group_members

function update_group_members($groupid, $newvalue)
{
    global $mysqlprefix;
    $link = connect();
    perform_query("delete from {$mysqlprefix}chatgroupoperator where groupid = {$groupid}", $link);
    foreach ($newvalue as $opid) {
        perform_query("insert into {$mysqlprefix}chatgroupoperator (groupid, operatorid) values ({$groupid},{$opid})", $link);
    }
    mysql_close($link);
}
开发者ID:laiello,项目名称:cartonbank,代码行数:10,代码来源:groupmembers.php

示例9: update_operator_groups

function update_operator_groups($operatorid, $newvalue)
{
    global $mysqlprefix;
    $link = connect();
    perform_query("delete from {$mysqlprefix}chatgroupoperator where operatorid = " . intval($operatorid), $link);
    foreach ($newvalue as $groupid) {
        perform_query(sprintf("insert into {$mysqlprefix}chatgroupoperator (groupid, operatorid) values (%s,%s)", intval($groupid), intval($operatorid)), $link);
    }
    mysql_close($link);
}
开发者ID:kuell,项目名称:chat,代码行数:10,代码来源:opgroups.php

示例10: update_settings

function update_settings()
{
    global $settings, $settings_in_db, $mysqlprefix;
    $link = connect();
    foreach ($settings as $key => $value) {
        if (!isset($settings_in_db[$key])) {
            perform_query("insert into {$mysqlprefix}chatconfig (vckey) values ('{$key}')", $link);
        }
        $query = sprintf("update {$mysqlprefix}chatconfig set vcvalue='%s' where vckey='{$key}'", mysql_real_escape_string($value));
        perform_query($query, $link);
    }
    mysql_close($link);
}
开发者ID:paulcn,项目名称:mibew,代码行数:13,代码来源:settings.php

示例11: update_settings

function update_settings()
{
    global $settings, $settings_in_db, $low_level_settings, $mysqlprefix;
    $link = connect();
    foreach ($settings as $key => $value) {
        // Don't store low level settings in the database to prevent them from being
        // unchangeable
        if (in_array($key, $low_level_settings)) {
            continue;
        }
        if (!isset($settings_in_db[$key])) {
            perform_query("insert into {$mysqlprefix}chatconfig (vckey) values ('" . mysql_real_escape_string($key, $link) . "')", $link);
        }
        $query = sprintf("update {$mysqlprefix}chatconfig set vcvalue='%s' where vckey='%s'", mysql_real_escape_string($value, $link), mysql_real_escape_string($key, $link));
        perform_query($query, $link);
    }
    mysql_close($link);
}
开发者ID:kuell,项目名称:chat,代码行数:18,代码来源:settings.php

示例12: displayform

function displayform($currentstudent = "")
{
    $dbc = connect_to_db("jed");
    $query = "select ID, lastname, firstname from student";
    $result = perform_query($dbc, $query);
    echo "<form method=\"get\">\n\t\t  <select name=\"studentmenu\">";
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $firstname = $row['firstname'];
        $lastname = $row['lastname'];
        $id = $row['ID'];
        if ($id == $currentstudent) {
            echo "<option value=\"{$id}\" selected>{$firstname} {$lastname}</option>\n";
        } else {
            echo "<option value=\"{$id}\">{$firstname} {$lastname}</option>\n";
        }
    }
    echo "</select>\n\t\t<input type=\"submit\" name=\"formsubmitted\" value=\"go\" />\n\t\t</form>";
    disconnect_from_db($dbc, $result);
}
开发者ID:lowriek,项目名称:CSCI1154_Examples,代码行数:19,代码来源:inclass.php

示例13: create_select

function create_select($menuname)
{
    echo "<select name= '{$menuname}'>\n";
    $dbc = connect_to_db("jed");
    $query = "select ID, lastname, firstname from student";
    $result = perform_query($dbc, $query);
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $firstname = $row['firstname'];
        $lastname = $row['lastname'];
        $id = $row['ID'];
        if (isset($_GET[$menuname]) && $_GET[$menuname] == $id) {
            echo "<option value = '{$id}' selected> {$firstname}  {$lastname} </option>\n";
        } else {
            echo "<option value = '{$id}'> {$firstname}  {$lastname} </option>\n";
        }
    }
    echo "</select>";
    disconnect_from_db($dbc, $result);
}
开发者ID:lowriek,项目名称:CSCI1154_Examples,代码行数:19,代码来源:create_select.php

示例14: extractName

	private function extractName($message) {
        $preges = array();
		$result = perform_query(
			"SELECT preg_name FROM lzecs",
			$this->dbLink, $_SERVER['PHP_SELF']
		);
        while($row = fetch_array($result)) { 
            $preges[] = $row['preg_name'];
        }
        foreach($preges as $preg) {
            preg_match_all("/$preg/", $message, $matches);
        }
        if(! isset($matches[1][0]))
            return "";

		// Modified below for http://code.google.com/p/php-syslog-ng/issues/detail?id=43 
		// $name = $matches[1][0];
		$name = addcslashes($matches[1][0], '\'');

		return $name;
	}
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:21,代码来源:LZECS.class.php

示例15: lookup

 public function lookup($message)
 {
     $name = $this->extractName($message);
     if (empty($name)) {
         return false;
     }
     if (($data = $this->cacheFetch($name)) !== false) {
         return $data;
     }
     $result = perform_query("SELECT message, explanation, action, datetime FROM " . CISCO_ERROR_TABLE . " WHERE name = '{$name}' LIMIT 1", $this->dbLink);
     if (!num_rows($result) > 0) {
         return false;
     }
     $data = array();
     $row = fetch_array($result, "ASSOC");
     array_push($data, $name);
     array_push($data, $row['message']);
     array_push($data, $row['explanation']);
     array_push($data, $row['action']);
     array_push($data, $row['datetime']);
     $this->cacheStore($name, $data);
     return $data;
 }
开发者ID:jeroenrnl,项目名称:php-syslog-ng,代码行数:23,代码来源:CEMDB.class.php


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