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


PHP sql::fetch_array方法代码示例

本文整理汇总了PHP中sql::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::fetch_array方法的具体用法?PHP sql::fetch_array怎么用?PHP sql::fetch_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql的用法示例。


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

示例1: content

 function content()
 {
     $db = new sql();
     $db->connect();
     if (time() < 1098388800) {
         $res = $db->query("select projects.id, name, company, category, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM projects left join votes on projects.id=votes.id group by projects.id, name, company, category order by gsum desc");
     } else {
         $res = $db->query("select projects.id, name, company, category, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM projects left join votes on projects.id=votes.id where grade>0 group by projects.id, name, company, category order by gsum desc");
     }
     $cats = array(1 => "A", "C", "Y");
     $tr = "";
     while ($data = $db->fetch_array($res)) {
         $res1 = $db->query("select * from categories where category_id={$data['category']}");
         $data1 = $db->fetch_array($res1);
         $url = "/projects/" . $cats[$data1["category_id"]] . "/";
         eval('$tr.="' . page::template("modules/resultTR") . '";');
     }
     if (!$tr) {
         $tr = "<p style=\"font-size: 0.85em;\">В настоящее время в данной номинации заявок не подано.</p><p style=\"font-size: 0.85em;\"><a href=\"/request/\">Заявки</a> принимаются до 15 октября 2004 года</p>";
     }
     $resultTr .= $tr;
     if ($resultTr) {
         eval('$projectsMain.="' . page::template("modules/resultMain") . '";');
     }
     $resultTr = "";
     if (time() < 1098388800) {
         $text = "<p>Здесь размещены текущие результаты голосования, обновляющиеся в режиме реального времени.</p><p>Для того, чтобы проголосовать за проект надо перейти на его страницу.</p><p>Вы можете поставить свою оценку каждому из 22 представленных проектов, но можете сделать это только 1 раз за весь период голосования.</p><p>Голосование открыто до 0:00 22 октября 2004 года.</p>";
     } else {
         $text = "<h3>Голование закрыто в&nbsp;0:00 22&nbsp;октября 2004&nbsp;года.</h3><p><i>При анализе хода голосования за&nbsp;проекты в&nbsp;интернете, Оргкомитет конкурса М2.&nbsp;Новый&nbsp;Дом&nbsp;2004. обнаружил многочисленные случаи злоупотребления при выставлении оценки 0&nbsp;баллов. В&nbsp;целях повышения релевантности итогов голосования, Оргкомитет принял решение не&nbsp;учитывать оценки 0&nbsp;баллов, выставленные за&nbsp;весь период голосования в&nbsp;интернете.</i></p>";
     }
     $this->elements["content"] = $text . $projectsMain;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:32,代码来源:votelist.class.php

示例2: defaultAction

 function defaultAction()
 {
     global $HTTP_SERVER_VARS;
     include "./lib/config.inc.php";
     $db = new sql();
     $db->connect();
     $result = $db->query('SELECT VERSION() AS version');
     if ($result != FALSE && $db->num_rows($result) > 0) {
         $row = $db->fetch_array($result);
         $match = $row['version'];
     } else {
         $result = $db->query('SHOW VARIABLES LIKE \'version\'');
         if ($result != FALSE && $db->num_rows($result) > 0) {
             $row = $db->fetch_array($result);
             $match = $row[1];
         }
     }
     $this->MYSQL_VER = $match;
     $this->PHP_OS = PHP_OS;
     $this->PHP_VERSION = PHP_VERSION;
     $this->CMS = $admin_config["name"] . " " . $admin_config["version"];
     $this->AUTHOR = $admin_config["author"];
     $this->HOME_PAGE = $admin_config["home_page"];
     $content = admin::template("info", $this);
     $this->elements["content"] = $content;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:26,代码来源:content.class.php

示例3: event_CreateRevision

 function event_CreateRevision(&$data)
 {
     $res = sql::query("\r\n\t\t\t\tSELECT \r\n\t\t\t\t\t*\r\n\t\t\t\tFROM \r\n\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_seo\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tID = '" . $data['id'] . "' AND\r\n\t\t\t\t\trevision = '" . $data['from'] . "'\r\n\t\t\t");
     while ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
         sql::query("\r\n\t\t\t\t\tINSERT INTO \r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_seo \r\n\t\t\t\t\tSET \r\n\t\t\t\t\t\tID='" . $data['id'] . "', \r\n\t\t\t\t\t\trevision='" . $data['to'] . "',\r\n\t\t\t\t\t\tkeywords='" . addslashes($row['keywords']) . "',\r\n\t\t\t\t\t\tdescription='" . addslashes($row['description']) . "'\r\n\t\t\t\t");
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:7,代码来源:plugin.php

示例4: language

 function language($language, $site, $load = false)
 {
     $res = sql::query("\r\n\t\t    \tSELECT \r\n\t\t\t\t    *\r\n\t\t\t    FROM\r\n    \t\t\t\t" . _TABLE_PREFIX_ . "language\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tid = '" . addslashes($language) . "' AND\r\n\t\t\t\t\tsite = '" . addslashes($site) . "'\r\n\t\t    ");
     if ($row = sql::fetch_array($res)) {
         $this->id = $row['id'];
         $this->name = $row['name'];
         $this->public = !!$row['public'];
     } else {
         $this->id = 'en';
         $this->name = 'English';
         $this->public = false;
     }
     @(include _BASE_LIBRARIES_ . 'resources/iso639to3166.php');
     $this->flag = strtolower($iso639to3166[$this->id]);
     if ($load) {
         // Load english strings first...
         $res = @mysql_query("\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t* \r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "strings\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tlanguage = 'en'\r\n\t\t\t\t");
         while ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
             $this->strings[$row['id']] = $row['value'];
         }
         if ($language != 'en') {
             $res = sql::query("\r\n\t\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t\t* \r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "strings\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tlanguage = '" . addslashes($language) . "'\r\n\t\t\t\t\t");
             while ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
                 $this->strings[$row['id']] = $row['value'];
             }
         }
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:28,代码来源:language.library.php

示例5: get_tree

function get_tree($id = 0, $open_nodes, $level = 0, $url = "")
{
    global $cid;
    $furl = $url;
    $level++;
    $style = $level == 1 ? " style=\"margin-left: 0px; padding-left: 0px;\"" : "";
    $db = new sql();
    $db->connect();
    $res = $db->query(_QUERY . " where pid={$id} order by sortorder");
    if ($db->num_rows($res) > 0) {
        $s .= "<ul{$style}>\n";
        while ($data = $db->fetch_array($res)) {
            $gc = got_child($data["id"]);
            $img = $gc ? $open_nodes[$data["id"]] ? "minus" : "plus" : "dot";
            $img1 = $gc ? $open_nodes[$data["id"]] ? "folderopen" : "folder" : "page";
            $pid = $open_nodes[$data["id"]] ? $data["pid"] : $data["id"];
            $checked = $data["id"] == $cid ? " checked" : "";
            $url .= "/" . $data["url"];
            $a_o = $gc ? "<a href=\"?id={$pid}\" class=\"{$class}\" id=\"tree\">" : "";
            $a_c = $gc ? "</a>" : "";
            $s .= "<li>{$a_o}<img src=\"../i/" . $img . ".gif\" alt=\"\" border=\"0\" align=\"absmiddle\" height=\"20\" width=\"20\" style=\"margin: 3px;\"><input type=\"radio\" name=\"sel\" id =\"sel\" value=\"" . $url . "/\" align=\"middle\" style=\"border-width: 0px\" onClick=\"onSelect()\"{$checked}><img src=\"../i/{$img1}.gif\" alt=\"\" border=\"0\" align=\"absmiddle\" height=\"20\" width=\"20\" style=\"margin: 3px;\"><span id=\"name" . $data["id"] . "\">" . $data["title"] . "</span>{$a_c}</li>\n";
            if ($open_nodes[$data["id"]]) {
                $s .= get_tree($data["id"], $open_nodes, $level, $url);
            } else {
                $url = $furl;
            }
        }
        $s .= "</ul>\n";
        return $s;
    } else {
        return;
    }
}
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:33,代码来源:links.php

示例6: defaultAction

 function defaultAction()
 {
     $db = new sql();
     $db->connect();
     $chid = $this->chid;
     include "lib/pagination.class.php";
     include "lib/orderby.class.php";
     $adminConfig = admin::adminConfig();
     for ($i = 1; $i < 4; $i++) {
         $voteTR = "";
         $orderBy = new orderBy("?chid=" . $this->chid . "&", array("id" => "№", "time" => "Дата", "name" => "Заголовок", "company" => "Компания", "gsum" => "Средний бал", "gcount" => "Проголосовало"), array("gsum" => "desc"), $this->field[$i], $this->order[$i], array("field[{$i}]", "order[{$i}]"));
         $pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "projects", "id");
         $res = $db->query("select projects.id, name, company, category_name, date, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM (projects LEFT JOIN categories ON projects.category = categories.category_id) left join votes on projects.id=votes.id where category={$i} group by projects.id, name, company, category_name, date " . $orderBy->orderByQuery() . " " . $pagination->limit());
         $page = $this->page ? "&page=" . $this->page : "";
         while ($data = $db->fetch_array($res)) {
             $data["date"] = date("d.m.Y", $data["date"]);
             eval('$voteTR.="' . admin::template("voteTR") . '";');
         }
         $pageBar = $pagination->bar();
         $th = $orderBy->bar();
         eval('$content.="' . admin::template("voteMain") . '";');
         $content .= "<br>";
     }
     $this->elements["content"] = $content;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:25,代码来源:vote.class.php

示例7: read

 function read()
 {
     $res = sql::query('SELECT * FROM ' . _TABLE_PREFIX_ . 'config');
     while ($row = sql::fetch_array($res)) {
         $this->data[$row['name']] = unserialize($row['data']);
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:7,代码来源:config.library.php

示例8: _changeLanguage

 function _changeLanguage($id, $language)
 {
     $res = sql::query("\r\n\t\t\t\tUPDATE \r\n\t\t\t\t\t" . _TABLE_PREFIX_ . "contents\r\n\t\t\t\tSET \r\n\t\t\t\t\tlanguage = '" . addslashes($language) . "'\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tID='" . $id . "'\r\n\t\t\t");
     $res = sql::query("\r\n\t\t\t\tSELECT \r\n\t\t\t\t\t*\r\n\t\t\t\tFROM \r\n\t\t\t\t\t" . _TABLE_PREFIX_ . "contents\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tparent = '" . $id . "'\r\n\t\t\t");
     while ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
         $this->_changeLanguage($row['ID'], $language);
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:8,代码来源:plugin.php

示例9: authorize

 function authorize($ticket)
 {
     ticket::cleanup();
     $res = sql::query("\r\n\t\t\t\tSELECT \r\n\t\t\t\t\t* \r\n\t\t\t\tFROM\r\n\t\t\t\t\t" . _TABLE_PREFIX_ . "tickets\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tticket = '" . addslashes($ticket) . "'\r\n\t\t\t");
     if ($row = sql::fetch_array($res)) {
         return $row['id'];
     }
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:8,代码来源:ticket.library.php

示例10: rightBar

 function rightBar()
 {
     $db = new sql();
     $db->connect();
     $res = $db->query(" select * from news order by time desc limit 0, 3");
     while ($data = $db->fetch_array($res)) {
         $this->elements["rightBar"] .= '<table><tr><th>' . $data["title"] . ':</th></tr><tr><td>' . $data["text"] . '</td></tr></table>';
     }
     $this->elements["rightBar"] = '<td valign="top" style="padding-left: 1em;">' . $this->elements["rightBar"] . '<p align="right"><a href="/news/">¬се новости &rarr;</a></p><br><i>¬ принципе, вы можете зайти и ознакомитьс¤ с <a href="/timeline/" target="_self">хронологией моих работ</a> (благо, их пока не так уж много).</i><p align="right"><a href="/card/" target="_self"> арта сайта &rarr;</a></p></td>';
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:10,代码来源:index.class.php

示例11: edit

 function edit()
 {
     $db = new sql();
     $db->connect();
     $res = $db->query("select * from news where id=" . $this->id);
     $data = $db->fetch_array($res);
     $data["text"] = htmlspecialchars($data["text"]);
     $select = admin::getDateSelectOptions($data["time"]);
     $chid = $this->chid;
     $action = "appendEdit";
     $header = "Редактирование";
     eval("\$content=\"" . admin::template("newsAdd", "FORMPOST", array("fields[title]" => "EXISTS")) . "\";");
     $this->elements["content"] = $content;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:14,代码来源:news.class.php

示例12: pagination

 function pagination($curUrl, $curPage, $recPerPage, $totalCount, $tableName = "", $fieldName = "", $where = "")
 {
     $this->url = $curUrl;
     $this->page = $curPage ? $curPage : 1;
     $this->recPerPage = $recPerPage;
     if ($totalCount) {
         $this->totalRecCount = $totlaCount;
     } else {
         $db = new sql();
         $db->connect();
         $db->query("select count({$fieldName}) as rec_count from {$tableName} {$where}");
         $data = $db->fetch_array($db->result);
         $this->totalRecCount = $data["rec_count"];
     }
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:15,代码来源:pagination.class.php

示例13: edit

 function edit()
 {
     $db = new sql();
     $db->connect();
     $res = $db->query("select * from projects where id=" . $this->id);
     $data = $db->fetch_array($res);
     $data["date"] = date("d.m.Y", $data["date"]);
     //$data["end"]=date("d.m.Y", $data["end"]);
     $category_selected[$data["category"]] = " selected";
     $chid = $this->chid;
     $action = "appendEdit";
     $header = "Редактирование";
     eval("\$content=\"" . admin::template("projectsAdd", "FORMPOST", array("fields[url]" => "EXISTS", "fields[title]" => "EXISTS")) . "\";");
     $this->elements["content"] = $content;
 }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:15,代码来源:projects.class.php

示例14: edit

    function edit()
    {
        $db = new sql();
        $db->connect();
        $res = $db->query("select * from users where id=" . $this->id);
        $data = $db->fetch_array($res);
        $data["description"] = htmlspecialchars($data["description"]);
        $chid = $this->chid;
        $action = "appendEdit";
        $id = '<tr>
			<td>№</td>
			<td><input maxlength="14" name="fields[id]" size="14" value="' . $this->id . '" readonly="readonly" style="width: auto;" value="' . $this->id . '"></td>
		</tr>';
        $header = "Редактирование";
        eval("\$content=\"" . admin::template("usersEdit", "FORMPOST", array("fields[login]" => "EXISTS", "fields[name]" => "EXISTS", "confirm" => "EQUAL fields[pass]", "fields[email]" => "EMAIL")) . "\";");
        $this->elements["content"] = $content;
    }
开发者ID:BackupTheBerlios,项目名称:sitexs,代码行数:17,代码来源:users.class.php

示例15: _deleteItem

 function _deleteItem($id)
 {
     global $manager;
     /* Delete pages recursively */
     $res = sql::query("\r\n\t\t\t\tSELECT \r\n\t\t\t\t\t*\r\n\t\t\t\tFROM \r\n\t\t\t\t\t" . _TABLE_PREFIX_ . "contents\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tparent = '" . $id . "'\r\n\t\t\t");
     while ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
         $this->_deleteItem($row['ID']);
     }
     /* Delete the plugin data */
     $delete = array('id' => $id);
     $manager->handleEvent('DeleteItem', $delete);
     /* Delete the revision history */
     revisions::doDeletePage($id);
     /* Delete */
     treeStorage::startTransaction();
     treeStorage::prepareForDelete($id);
     $res = sql::query("\r\n\t\t\t\tDELETE FROM\r\n\t\t\t\t\t" . _TABLE_PREFIX_ . "contents\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tID='" . $id . "'\r\n\t\t\t");
     treeStorage::stopTransaction();
 }
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:19,代码来源:plugin.php


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