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


PHP sqlfetch函数代码示例

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


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

示例1: buildVariableEnv

function buildVariableEnv($uid, $gid, $tid, &$vardisp, &$bounds, &$privilege, &$tree, &$condensed, &$autoDisplay)
{
    $result = sqlquery("SELECT view_row.name AS user_name, variable.name AS var_name, path, warning_bound, error_bound, alarm_order, view_row.filter as varfilter, view_table.filter as viewfilter, display, auto_display, view_row.vid AS vid " . "FROM variable, view_row, view_table " . "WHERE variable.command='variable' AND (view_table.uid='{$uid}' OR view_table.uid='{$gid}') AND view_table.tid='{$tid}' AND view_row.tid='{$tid}' AND variable.vid=view_row.vid ORDER BY view_row.ordering");
    while ($result && ($arr = sqlfetch($result))) {
        $vid = $arr["vid"];
        if (!hasAccessToVariable($vid)) {
            continue;
        }
        $path = $arr["path"];
        if ($arr["varfilter"] != "" && ($path = filterPath($path, $arr["varfilter"])) == "") {
            continue;
        }
        if ($arr["viewfilter"] != "" && ($path = filterPath($path, $arr["viewfilter"])) == "") {
            continue;
        }
        $condensed = $arr["display"] == "condensed";
        $autoDisplay = $arr["auto_display"] == "auto";
        $varName = getVarName($path);
        $vardisp[$varName] = $arr["user_name"];
        $bounds[$varName] = array($arr["warning_bound"], $arr["error_bound"], $arr["alarm_order"]);
        $privilege[$varName] = getVariableRight($vid);
        $address = explode(".", $path);
        //echo "add to tree address $path<br>\n";
        if (!isset($numsteps)) {
            $numsteps = count($address);
        }
        if ($numsteps != count($address)) {
            echo "Invalid table <b>{$tid}</b>, contains different variable path length (typically, mixed shard/server/service variables with entity variables)\n";
            return;
        }
        addToNode($tree, $address, 0);
    }
}
开发者ID:ryzom,项目名称:ryzomcore,代码行数:33,代码来源:display_view.php

示例2: getShardLockState

function getShardLockState()
{
    global $shardLockState, $uid, $REMOTE_ADDR, $enablelock, $shardList;
    global $ASHost, $ASPort;
    $shardLockState = array();
    if (count($shardList) > 0) {
        foreach ($shardList as $shard => $s) {
            $shardLockState[$shard]['lock_state'] = $enablelock ? 0 : 1;
        }
    }
    $result = sqlquery("SELECT * FROM shard_annotation");
    while ($result && ($arr = sqlfetch($result))) {
        if ($enablelock) {
            if ($arr['lock_user'] == 0) {
                $lockState = 0;
                // unlocked
            } else {
                if ($arr['lock_user'] == $uid && $arr['lock_ip'] == $REMOTE_ADDR) {
                    $lockState = 1;
                    // locked by user
                } else {
                    $lockState = 2;
                    // locked by another user
                }
            }
        } else {
            $lockState = 1;
        }
        $shardLockState[$arr['shard']] = array('user_annot' => $arr['user'], 'annot' => htmlentities($arr['annotation'], ENT_QUOTES), 'post_date' => $arr['post_date'], 'lock_user' => $arr['lock_user'], 'lock_ip' => $arr['lock_ip'], 'lock_date' => $arr['lock_date'], 'lock_state' => $lockState, 'ASAddr' => $arr['ASAddr'], 'alias' => $arr['alias']);
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:31,代码来源:init.php

示例3: getForm

 static function getForm($id)
 {
     $id = sqlescape($id);
     $form = sqlfetch(sqlquery("SELECT * FROM btx_form_builder_forms WHERE id = '{$id}'"));
     if (!$form) {
         return false;
     }
     $fields = array();
     $object_count = 0;
     $field_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE form = '{$id}' AND `column` = '0' ORDER BY position DESC, id ASC");
     while ($field = sqlfetch($field_query)) {
         $object_count++;
         if ($field["type"] == "column") {
             // Get left column
             $column_fields = array();
             $column_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE `column` = '" . $field["id"] . "' AND `alignment` = 'left' ORDER BY position DESC, id ASC");
             while ($sub_field = sqlfetch($column_query)) {
                 $column_fields[] = $sub_field;
                 $object_count++;
             }
             $field["fields"] = $column_fields;
             $fields[] = $field;
             // Get right column
             $column_fields = array();
             $column_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE `column` = '" . $field["id"] . "' AND `alignment` = 'right' ORDER BY position DESC, id ASC");
             while ($sub_field = sqlfetch($column_query)) {
                 $column_fields[] = $sub_field;
                 $object_count++;
             }
             $field["fields"] = $column_fields;
             $fields[] = $field;
             // Column start/end count as objects so we add 3 since there's two columns
             $object_count += 3;
         } else {
             $fields[] = $field;
         }
     }
     $form["fields"] = $fields;
     $form["object_count"] = $object_count - 1;
     // We start at 0
     return $form;
 }
开发者ID:jmason03,项目名称:bigtree-form-builder,代码行数:42,代码来源:btx-form-builder.php

示例4: str_replace

            if (strpos($file, "site/extensions/{$id}/") === 0) {
                BigTree::copyFile(SERVER_ROOT . $file, SERVER_ROOT . "extensions/{$id}/public/" . str_replace("site/extensions/{$id}/", "", $file));
                // Move into the site/extensions/ folder and then copy into /public/
            } else {
                BigTree::moveFile(SERVER_ROOT . $file, SITE_ROOT . "extensions/{$id}/" . substr($file, 5));
                BigTree::copyFile(SITE_ROOT . "extensions/{$id}/" . substr($file, 5), SERVER_ROOT . "extensions/{$id}/public/" . substr($file, 5));
            }
        }
        // If we have a place to move it to, move it.
        if ($d) {
            BigTree::moveFile(SERVER_ROOT . $file, SERVER_ROOT . "extensions/{$id}/" . $d);
        }
    }
}
// If this package already exists, we need to do a diff of the tables, increment revision numbers, and add SQL statements.
$existing = sqlfetch(sqlquery("SELECT * FROM bigtree_extensions WHERE id = '" . sqlescape($id) . "' AND type = 'extension'"));
if ($existing) {
    $existing_json = json_decode($existing["manifest"], true);
    // Increment revision numbers
    $revision = $package["revision"] = intval($existing_json["revision"]) + 1;
    $package["sql_revisions"] = (array) $existing_json["sql_revisions"];
    $package["sql_revisions"][$revision] = array();
    // Diff the old tables
    foreach ($existing_json["components"]["tables"] as $table => $create_statement) {
        // If the table exists in the new manifest, we're going to see if they're identical
        if (isset($package["components"]["tables"][$table])) {
            // We're going to create a temporary table of the old structure to compare to the current table
            $create_statement = preg_replace("/CREATE TABLE `([^`]*)`/i", "CREATE TABLE `bigtree_extension_temp`", $create_statement);
            $create_statement = preg_replace("/CONSTRAINT `([^`]*)`/i", "", $create_statement);
            sqlquery("DROP TABLE IF EXISTS `bigtree_extension_temp`");
            sqlquery($create_statement);
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:create.php

示例5: updatePageParent

 function updatePageParent($page, $parent)
 {
     $page = sqlescape($page);
     $parent = sqlescape($parent);
     if ($this->Level < 1) {
         $this->stop("You are not allowed to move pages.");
     }
     // Get the existing path so we can create a route history
     $current = sqlfetch(sqlquery("SELECT path FROM bigtree_pages WHERE id = '{$page}'"));
     $old_path = sqlescape($current["path"]);
     sqlquery("UPDATE bigtree_pages SET parent = '{$parent}' WHERE id = '{$page}'");
     $path = sqlescape($this->getFullNavigationPath($page));
     // Set the route history
     sqlquery("DELETE FROM bigtree_route_history WHERE old_route = '{$path}' OR old_route = '{$old_path}'");
     sqlquery("INSERT INTO bigtree_route_history (`old_route`,`new_route`) VALUES ('{$old_path}','{$path}')");
     // Update the page with its new path.
     sqlquery("UPDATE bigtree_pages SET path = '{$path}' WHERE id = '{$page}'");
     // Update the paths of any child pages.
     $this->updateChildPagePaths($page);
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:20,代码来源:admin.php

示例6: sqlquery

echo "{\n";
echo "\treturn true;\n";
echo "}\n";
echo "\n";
echo "//--></script>\n";
// input variables :
// - $preselServ : preselected service address
// - $execCommand : executed command on preselected service, like a normal service
//
echo "<br><br>\n";
echo "<table border=0><tr valign=top>\n";
echo "<form method=post action='" . $_SERVER['PHP_SELF'] . "' name='cmdform'>\n";
echo "<td>\n";
$result = sqlquery("SELECT DISTINCT shard FROM service ORDER BY shard");
echo "<select multiple size=" . sqlnumrows($result) . " name='selshards[]'>";
while ($result && ($arr = sqlfetch($result))) {
    $selected = isset($selshards) && in_array($arr["shard"], $selshards) || (isset($admfilter_shard) && $admfilter_shard != "" && strstr($arr["shard"], $admfilter_shard) || $admfilter_shard == "" && !isset($selshards));
    if ($selected) {
        $selected_shards[] = $arr["shard"];
    }
    echo "<option value='" . $arr["shard"] . "'" . ($selected ? " selected" : "") . ">" . $arr["shard"];
}
echo "</select>\n";
echo "</td>\n";
echo "<td width=30>&nbsp;</td>\n";
echo "<td>\n";
echo "<table border=0>\n";
echo "<tr><th align=left>Player/Character name</th></tr>\n";
echo "<tr><td><input name=char_name value='" . stripslashes($char_name) . "' size=50 maxlength=20480></td>\n";
echo "<td><input type=submit value='Locate'></td></tr>\n";
echo "</form></table>\n";
开发者ID:cls1991,项目名称:ryzomcore,代码行数:31,代码来源:player_locator.php

示例7: polrauth

<?php

require_once '../lib-core.php';
require_once '../lib-auth.php';
$polrauth = new polrauth();
$baseval = $mysqli->real_escape_string($_POST['baseval']);
$userinfo = $polrauth->islogged();
if (!is_array($userinfo)) {
    //not logged in
    die('401 Unauthorized (not logged in)');
}
$role = $userinfo['role'];
$user = $mysqli->real_escape_string($userinfo['username']);
$date = $mysqli->real_escape_string(time());
if ($role != 'adm') {
    die('401 Unauthorized (not admin)');
}
//if all works out
$orig = $mysqli->real_escape_string(sqlfetch('redirinfo', 'rurl', 'baseval', $baseval));
$query = "UPDATE redirinfo SET rurl='disabled', etc2='Disabled by {$user} on UNIXDATE {$date}', etc='{$orig}' WHERE baseval='{$baseval}';";
$result = $mysqli->query($query) or die('error');
echo 'success';
die;
//all works out :)
开发者ID:MineHarry01,项目名称:polr,代码行数:24,代码来源:ucp-disablelink.php

示例8: handle404

 function handle404($url)
 {
     $url = sqlescape(htmlspecialchars(strip_tags(rtrim($url, "/"))));
     $f = sqlfetch(sqlquery("SELECT * FROM bigtree_404s WHERE broken_url = '{$url}'"));
     if (!$url) {
         return true;
     }
     if ($f["redirect_url"]) {
         if ($f["redirect_url"] == "/") {
             $f["redirect_url"] = "";
         }
         if (substr($f["redirect_url"], 0, 7) == "http://" || substr($f["redirect_url"], 0, 8) == "https://") {
             $redirect = $f["redirect_url"];
         } else {
             $redirect = WWW_ROOT . str_replace(WWW_ROOT, "", $f["redirect_url"]);
         }
         sqlquery("UPDATE bigtree_404s SET requests = (requests + 1) WHERE id = '" . $f["id"] . "'");
         BigTree::redirect($redirect, "301");
         return false;
     } else {
         header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
         if ($f) {
             sqlquery("UPDATE bigtree_404s SET requests = (requests + 1) WHERE id = '" . $f["id"] . "'");
         } else {
             sqlquery("INSERT INTO bigtree_404s (`broken_url`,`requests`) VALUES ('{$url}','1')");
         }
         define("BIGTREE_DO_NOT_CACHE", true);
         return true;
     }
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:30,代码来源:cms.php

示例9: updatePendingItemField

 static function updatePendingItemField($id, $field, $value)
 {
     $id = sqlescape($id);
     $item = sqlfetch(sqlquery("SELECT * FROM bigtree_pending_changes WHERE id = '{$id}'"));
     $changes = json_decode($item["changes"], true);
     if (is_array($value)) {
         $value = BigTree::translateArray($value);
     }
     $changes[$field] = $value;
     $changes = sqlescape(json_encode($changes));
     sqlquery("UPDATE bigtree_pending_changes SET changes = '{$changes}' WHERE id = '{$id}'");
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:12,代码来源:auto-modules.php

示例10: tableContents

 static function tableContents($table)
 {
     $inserts = array();
     // Figure out which columns are binary and need to be pulled as hex
     $description = BigTree::describeTable($table);
     $column_query = array();
     $binary_columns = array();
     foreach ($description["columns"] as $key => $column) {
         if ($column["type"] == "tinyblob" || $column["type"] == "blob" || $column["type"] == "mediumblob" || $column["type"] == "longblob" || $column["type"] == "binary" || $column["type"] == "varbinary") {
             $column_query[] = "HEX(`{$key}`) AS `{$key}`";
             $binary_columns[] = $key;
         } else {
             $column_query[] = "`{$key}`";
         }
     }
     // Get the rows out of the table
     $qq = sqlquery("SELECT " . implode(", ", $column_query) . " FROM `{$table}`");
     while ($ff = sqlfetch($qq)) {
         $keys = array();
         $vals = array();
         foreach ($ff as $key => $val) {
             $keys[] = "`{$key}`";
             if ($val === null) {
                 $vals[] = "NULL";
             } else {
                 if (in_array($key, $binary_columns)) {
                     $vals[] = "X'" . str_replace("\n", "\\n", sqlescape($val)) . "'";
                 } else {
                     $vals[] = "'" . str_replace("\n", "\\n", sqlescape($val)) . "'";
                 }
             }
         }
         $inserts[] = "INSERT INTO `{$table}` (" . implode(",", $keys) . ") VALUES (" . implode(",", $vals) . ")";
     }
     return $inserts;
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:36,代码来源:utils.php

示例11: foreach

foreach ($modules as $m) {
    // Get all auto module view actions for this module.
    $actions = $admin->getModuleActions($m);
    foreach ($actions as $action) {
        if ($action["view"]) {
            $view = BigTreeAutoModule::getView($action["view"]);
            $m_results = array();
            $table_description = BigTree::describeTable($view["table"]);
            $qparts = array();
            foreach ($table_description["columns"] as $column => $data) {
                $qparts[] = "`{$column}` LIKE {$w}";
            }
            // Get matching results
            $qs = sqlquery("SELECT * FROM `" . $view["table"] . "` WHERE " . implode(" OR ", $qparts));
            // Ignore SQL failures because we might have bad collation.
            while ($r = sqlfetch($qs, true)) {
                foreach ($r as &$piece) {
                    $piece = $cms->replaceInternalPageLinks($piece);
                }
                unset($piece);
                $m_results[] = $r;
                $total_results++;
            }
            if (count($m_results)) {
                $results[$m["name"]][] = array("view" => $view, "results" => $m_results, "module" => $m);
            }
        }
    }
}
?>
<form class="adv_search" method="get" action="<?php 
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:search.php

示例12: logUser

function logUser($uid, $act, $prefix = "")
{
    global $HTTP_USER_AGENT, $REMOTE_ADDR, $userlogpath;
    $result = sqlquery("SELECT login FROM user WHERE uid='{$uid}'");
    if ($result && ($result = sqlfetch($result))) {
        $login = $result["login"];
        $filename = $userlogpath . "/" . $login . ".log";
        $file = fopen($filename, "a");
        if ($file) {
            fwrite($file, ($prefix != "" ? $prefix . " " : "") . date("Y/m/d H:i:s") . " {$uid}:{$login}:{$HTTP_USER_AGENT}:{$REMOTE_ADDR} {$act}\n");
            fclose($file);
        }
    } else {
        $filename = $userlogpath . "/unreferenced_user.log";
        $file = fopen($filename, "a");
        if ($file) {
            fwrite($file, date("Y/m/d H:i:s") . " {$uid}:<unknown login>:{$HTTP_USER_AGENT}:{$REMOTE_ADDR} {$act}\n");
            fclose($file);
        }
    }
    /*
    		$result = sqlquery("SELECT http_agent, remote_address, act FROM user_log WHERE uid='$uid' ORDER BY log_date DESC LIMIT 1");
    		if (!$result || !($arr=mysql_fetch_array($result)) || $arr["http_agent"]!=$HTTP_USER_AGENT || $arr["remote_address"]!=$REMOTE_ADDR || $arr["act"]!=$act)
    		{
    			sqlquery("INSERT INTO user_log SET uid='$uid', http_agent='$HTTP_USER_AGENT', remote_address='$REMOTE_ADDR', log_date=NOW(), act='$act'");
    		}
    */
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:28,代码来源:session_auth.php

示例13: _local_bigtree_update_102

function _local_bigtree_update_102()
{
    sqlquery("ALTER TABLE bigtree_field_types ADD COLUMN `use_cases` TEXT NOT NULL AFTER `name`");
    sqlquery("ALTER TABLE bigtree_field_types ADD COLUMN `self_draw` CHAR(2) NULL AFTER `use_cases`");
    $q = sqlquery("SELECT * FROM bigtree_field_types");
    while ($f = sqlfetch($q)) {
        $use_cases = sqlescape(json_encode(array("templates" => $f["pages"], "modules" => $f["modules"], "callouts" => $f["callouts"], "settings" => $f["settings"])));
        sqlquery("UPDATE bigtree_field_types SET use_cases = '{$use_cases}' WHERE id = '" . sqlescape($f["id"]) . "'");
    }
    sqlquery("ALTER TABLE bigtree_field_types DROP `pages`, DROP `modules`, DROP `callouts`, DROP `settings`");
}
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:11,代码来源:database.php

示例14: next

    $numLines = ($numRes - $numRows - 2) / $numRows;
    next($arr);
    for ($i = 0; $i < $numRows; ++$i) {
        $vars[] = current($arr);
        next($arr);
    }
    unset($shards);
    for ($i = 0; $i < $numLines; ++$i) {
        unset($l);
        foreach ($vars as $var) {
            $l[$var] = current($arr);
            next($arr);
        }
        $sql_query = "SELECT * FROM server WHERE name='" . $l['server'] . "'";
        $sql_res = sqlquery($sql_query);
        if ($sql_res && ($sql_arr = sqlfetch($sql_res))) {
            $l['address'] = $sql_arr['address'];
        }
        $availableLAS[] = $l;
    }
}
/*
	echo "<pre>";
	print_r($availableLAS);
	echo "</pre>";
*/
importParam('exec_query');
importParam('refresh_result');
importParam('query');
importParam('query_id');
importParam('page');
开发者ID:ryzom,项目名称:ryzomcore,代码行数:31,代码来源:las_interface.php

示例15: getTableSelectOptions

 static function getTableSelectOptions($default = false)
 {
     global $bigtree;
     $q = sqlquery("SHOW TABLES");
     while ($f = sqlfetch($q)) {
         $tname = $f["Tables_in_" . $bigtree["config"]["db"]["name"]];
         if (isset($bigtree["config"]["show_all_tables_in_dropdowns"]) || substr($tname, 0, 8) !== "bigtree_" || $tname == $default) {
             if ($default == $f["Tables_in_" . $bigtree["config"]["db"]["name"]]) {
                 echo '<option selected="selected">' . $f["Tables_in_" . $bigtree["config"]["db"]["name"]] . '</option>';
             } else {
                 echo '<option>' . $f["Tables_in_" . $bigtree["config"]["db"]["name"]] . '</option>';
             }
         }
     }
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:15,代码来源:utils.php


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