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


PHP Query函数代码示例

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


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

示例1: DemLuotTruyCap

 public static function DemLuotTruyCap()
 {
     $query = "SELECT count(1) FROM online";
     $r = Query($query);
     $row = mysql_fetch_array($r);
     return $row[0];
 }
开发者ID:nsknet,项目名称:dandabook,代码行数:7,代码来源:online.php

示例2: update

function update($sem)
{
    foreach (glob("./{$sem}/*.csv") as $filename) {
        $dept = substr($filename, 0, -4);
        if ($sem == "fall") {
            $dept = substr($dept, 7);
        } else {
            if ($sem == "winter") {
                $dept = substr($dept, 9);
            }
        }
        echo $dept . "\n";
        if (($handle = fopen($filename, "r")) !== FALSE) {
            Query("DROP TABLE IF EXISTS {$dept}");
            Query("CREATE TABLE IF NOT EXISTS {$dept} (NAME text, SECTION text, \n\t\t\t\tDAY text, START time, FINISH time, LOCATION text)");
            while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                $q = "INSERT INTO {$dept} VALUES (";
                foreach ($data as $key => $value) {
                    $q .= "'{$value}',";
                }
                $q = substr($q, 0, -1);
                $q .= ")";
                Query($q);
            }
            fclose($handle);
        }
    }
}
开发者ID:4cylinder,项目名称:uoftscheduler,代码行数:28,代码来源:updatedatabase.php

示例3: getWikiPage

function getWikiPage($id, $rev = 0)
{
    global $canedit, $canmod;
    $ptitle = $id;
    if (!$ptitle) {
        $ptitle = 'Main_page';
    } else {
        $ptitle = title2url($ptitle);
    }
    // so that we don't have for example 'Main page' and 'Main_page' being considered different pages
    if ($rev < 0) {
        $rev = 0;
    }
    $page = Query("SELECT p.*, pt.date, pt.user, pt.text FROM {wiki_pages} p LEFT JOIN {wiki_pages_text} pt ON pt.id=p.id AND pt.revision=" . ($rev > 0 ? 'LEAST(p.revision,{1})' : 'p.revision') . " WHERE p.id={0}", $ptitle, $rev);
    if (!NumRows($page)) {
        $page = array('id' => $ptitle, 'revision' => 0, 'flags' => 0, 'text' => '', 'new' => 1);
        header('HTTP/1.1 404 Not Found');
        header('Status: 404 Not Fount');
    } else {
        $page = Fetch($page);
    }
    $page['istalk'] = strtolower(substr($ptitle, 0, 5)) == 'talk:';
    $page['ismain'] = strtolower($ptitle) == 'main_page';
    $page['canedit'] = $canedit && (!($page['flags'] & WIKI_PFLAG_SPECIAL) || HasPermission('wiki.makepagesspecial'));
    return $page;
}
开发者ID:Servault,项目名称:Blargboard,代码行数:26,代码来源:wikilib.php

示例4: printResult

function printResult()
{
    $results = Query();
    foreach ($results as $row) {
        printMonster($row);
    }
}
开发者ID:audric-perrin,项目名称:sitedofus,代码行数:7,代码来源:printResult.php

示例5: updatePerson

function updatePerson($personid, $name)
{
    if ($personid) {
        return Query("UPDATE `persons` SET `name`= '" . $name . "' WHERE (`personid`= " . $personid . ")", debug_backtrace());
    } else {
        return NULL;
    }
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:8,代码来源:upt_persons.php

示例6: insert_relationtype

function insert_relationtype($reltype)
{
    $reltypeid = 0;
    if (NULL == ($reltypeid = exists_relationtype($reltype))) {
        $reltypeid = Query("INSERT INTO `reltypes` (`reltype`) VALUES ('" . $reltype . "')", debug_backtrace());
    }
    return $reltypeid;
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:8,代码来源:insert.php

示例7: get_relationtypes

function get_relationtypes($userid = 0)
{
    if ($userid) {
        return Query("SELECT DISTINCT reltypes.reltype\n\t\tFROM relations AS UsersToPersons,persons,relations AS PersonsToPersons,relations_reltype,reltypes\n\t\tWHERE\n\t\tUsersToPersons.table1 = 'users'\n\t\tAND UsersToPersons.table2 = 'persons'\n\t\tAND UsersToPersons.id1 = " . $userid . "\n\t\tAND UsersToPersons.id2 = persons.personid\n\t\tAND PersonsToPersons.table1 = 'persons'\n\t\tAND PersonsToPersons.table2 = 'persons'\n\t\tAND PersonsToPersons.id1 = persons.personid\n\t\tAND relations_reltype.relationid = PersonsToPersons.relationid\n\t\tAND reltypes.reltypeid = relations_reltype.reltypeid", debug_backtrace());
    } else {
        return 0;
    }
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:8,代码来源:select.php

示例8: FetchResult

 function FetchResult($query, $row = 0, $field = 0)
 {
     $res = Query($query);
     if (mysql_numrows($res) == 0) {
         return -1;
     }
     return mysql_result($res, $row, $field);
 }
开发者ID:RoadrunnerWMC,项目名称:ABXD-legacy,代码行数:8,代码来源:mysql.php

示例9: get_phonetypes

function get_phonetypes($userid = 0)
{
    if ($userid) {
        return Query("SELECT DISTINCT phones.phonetype\n\t\tFROM relations AS RELUSERS,phones,relations AS RELPHONES\n\t\tWHERE RELUSERS.id1 = " . $userid . " AND\n\t\t(RELUSERS.table1 LIKE '%users%' AND\n\t\tRELUSERS.table2 LIKE '%persons%' OR\n\t\tRELUSERS.table1 LIKE '%users%' AND\n\t\tRELUSERS.table2 LIKE '%companies%' OR\n\t\tRELUSERS.table1 LIKE '%users%' AND\n\t\tRELUSERS.table2 LIKE '%schools%') AND\n\t\tRELPHONES.table2 = 'phones' AND\n\t\tphones.phoneid = RELPHONES.id2 AND\n\t\tRELPHONES.table1 = RELUSERS.table2 AND\n\t\tRELPHONES.id1 = RELUSERS.id2\n\t\tORDER BY phones.phoneid DESC", debug_backtrace());
    } else {
        return 0;
    }
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:8,代码来源:sel_phones.php

示例10: member

function member($id)
{
    if ($id > 0) {
        $sql = "select * from ly_users where id='{$id}'";
        $query = Query($sql);
        $row = GetRow($query);
        return $row;
    }
}
开发者ID:uwitec,项目名称:ly-dorice,代码行数:9,代码来源:global.func.php

示例11: insert_log

function insert_log($userid = 0, $REMOTE_ADDR, $REMOTE_PORT, $HTTP_USER_AGENT, $REQUEST_URI)
{
    if ($userid) {
        Query("INSERT INTO logs(userid,REMOTE_ADDR,REMOTE_PORT,HTTP_USER_AGENT,REQUEST_URI) VALUES(" . $userid . ",'" . $REMOTE_ADDR . "','" . $REMOTE_PORT . "','" . $HTTP_USER_AGENT . "','" . $REQUEST_URI . "')", debug_backtrace());
        return 1;
    } else {
        return NULL;
    }
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:9,代码来源:ins_user.php

示例12: get_person_count

function get_person_count($userid = 0)
{
    if ($userid) {
        $Result = Query("SELECT COUNT(*) AS count\n\t\tFROM persons\n\t\tWHERE userid = " . $userid . "", debug_backtrace());
        return (int) $Result[0]['count'];
    } else {
        return NULL;
    }
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:9,代码来源:sel_persons.php

示例13: insert_alias

function insert_alias($alias)
{
    $alias = $alias;
    $aliasid = 0;
    if (NULL == ($aliasid = exists_alias($alias))) {
        $aliasid = Query("INSERT INTO `aliases` (`alias`) VALUES ( '" . $alias . "' )", debug_backtrace());
    }
    return $aliasid;
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:9,代码来源:ins_person.php

示例14: __construct

 public function __construct($page = 1, $limit = 10)
 {
     $this->db = Query(array('type' => 'sqlite', 'host' => '', 'user' => '', 'pass' => '', 'port' => '', 'database' => '', 'file' => 'db/sample.db', 'prefix' => '', 'alias' => 'default'));
     $this->ret = array('status' => 'success', 'msg' => '', 'data' => '');
     $this->tbl = 'sales';
     $this->data = false;
     $this->setData = array();
     return $this;
 }
开发者ID:ax5ui,项目名称:ax5ui-kernel,代码行数:9,代码来源:json_data.php

示例15: loadSmiliesOrdered

function loadSmiliesOrdered()
{
    global $smiliesOrdered;
    $rSmilies = Query("select * from {smilies}");
    $smilies = array();
    while ($smiley = Fetch($rSmilies)) {
        $smiliesOrdered[] = $smiley;
    }
}
开发者ID:knytrune,项目名称:ABXD,代码行数:9,代码来源:smilies.php


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