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


PHP sql_fetch_array函数代码示例

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


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

示例1: popular

function popular($skin_dir = 'basic', $pop_cnt = 7, $date_cnt = 3)
{
    global $config, $g5;
    if (!$skin_dir) {
        $skin_dir = 'basic';
    }
    $date_gap = date("Y-m-d", G5_SERVER_TIME - $date_cnt * 86400);
    $sql = " select pp_word, count(*) as cnt from {$g5['popular_table']} where pp_date between '{$date_gap}' and '" . G5_TIME_YMD . "' group by pp_word order by cnt desc, pp_word limit 0, {$pop_cnt} ";
    $result = sql_query($sql);
    for ($i = 0; $row = sql_fetch_array($result); $i++) {
        $list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
    }
    ob_start();
    if (G5_IS_MOBILE) {
        $popular_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
        $popular_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
    } else {
        $popular_skin_path = G5_SKIN_PATH . '/popular/' . $skin_dir;
        $popular_skin_url = G5_SKIN_URL . '/popular/' . $skin_dir;
    }
    include_once $popular_skin_path . '/popular.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:ned3y2k,项目名称:youngcart5,代码行数:27,代码来源:popular.lib.php

示例2: sql_fetch

function sql_fetch($sql, $error = G5_DISPLAY_SQL_ERROR)
{
    $result = sql_query($sql, $error);
    //$row = @sql_fetch_array($result) or die("<p>$sql<p>" . mysql_errno() . " : " .  mysql_error() . "<p>error file : $_SERVER['SCRIPT_NAME']");
    $row = sql_fetch_array($result);
    return $row;
}
开发者ID:HanSJin,项目名称:dongal,代码行数:7,代码来源:common.php

示例3: latest

function latest($skin_dir = "", $bo_table, $rows = 10, $subject_len = 40, $options = "")
{
    global $g4;
    if ($skin_dir) {
        $GLOBALS['latest_skin_path'] = $latest_skin_path = "{$g4['path']}/skin/latest/{$skin_dir}";
    } else {
        $GLOBALS['latest_skin_path'] = $latest_skin_path = "{$g4['path']}/skin/latest/basic";
    }
    $list = array();
    $sql = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
    $board = sql_fetch($sql);
    $tmp_write_table = $g4['write_prefix'] . $bo_table;
    // 게시판 테이블 전체이름
    $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";
    //explain($sql);
    $result = sql_query($sql);
    for ($i = 0; $row = sql_fetch_array($result); $i++) {
        $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
    }
    ob_start();
    include "{$latest_skin_path}/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:ragi79,项目名称:g4dtd,代码行数:25,代码来源:latest.lib.php

示例4: checksuspended

function checksuspended()
{
    testremote();
    $db_a = tDataConnect();
    $m_conn = mDataConnect();
    $query_local = "select * from suspendedtoday";
    $query_remote = "select * from " . trim($_SESSION["mServer"]) . "." . trim($_SESSION["mDatabase"]) . ".dbo.suspendedtoday";
    $query = "select * from suspendedlist";
    if ($_SESSION["standalone"] == 1) {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $result = mssql_query($query_local, $db_a);
        } else {
            $result = mysql_query($query, $db_a);
        }
    } else {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $result = sql_query($query_remote, $db_a);
        } else {
            $result = mysql_query($query, $m_conn);
        }
    }
    $num_rows = sql_fetch_array($result);
    if ($num_rows == 0) {
        return 0;
    } else {
        return 1;
    }
    sql_close($db_a);
}
开发者ID:jdpurdyvi,项目名称:IS4C,代码行数:29,代码来源:special.php

示例5: getFromCache

 public static function getFromCache($cacheid)
 {
     $rs = sql("SELECT latitude, longitude FROM caches WHERE cache_id = &1", $cacheid);
     $r = sql_fetch_array($rs);
     mysql_free_result($rs);
     return new Coordinate_Coordinate($r['latitude'], $r['longitude']);
 }
开发者ID:PaulinaKowalczuk,项目名称:oc-server3,代码行数:7,代码来源:Coordinate.php

示例6: object_list

function object_list()
{
    global $dbi;
    $eventsResult = sql_query('SELECT id, version, typactive, typdesc, ttypeliga.mgroup_id FROM ttypeliga LEFT JOIN tmessagegroup ON ttypeliga.mgroup_id = tmessagegroup.mgroup_id', $dbi);
    # Table header
    $ret = '<table id="eventtable"><tr>';
    $ret = $ret . '<td class="thead">Id</td>';
    $ret = $ret . '<td class="thead">Version</td>';
    $ret = $ret . '<td class="thead">Active</td>';
    $ret = $ret . '<td class="thead">Description</td>';
    $ret = $ret . '<td class="thead">Message group id</td>';
    $ret = $ret . '<td class="thead">Edit</td>';
    $ret = $ret . '<td class="thead">Delete</td>';
    while (list($id, $version, $typactive, $typdesc, $mgroup_id) = sql_fetch_row($eventsResult, $dbi)) {
        $ret = $ret . '<tr>';
        $ret = $ret . '<td>' . $id . '</td>';
        $ret = $ret . '<td>' . $version . '</td>';
        $ret = $ret . '<td>' . ($typactive == 1 ? 'Ja' : 'Nein') . '</td>';
        $ret = $ret . '<td>' . $typdesc . '</td>';
        $mgroup_result = sql_query('SELECT mgroupname FROM tmessagegroup WHERE mgroup_id = ' . $mgroup_id, $dbi);
        $mgroup_name = sql_fetch_array($mgroup_result, $dbi);
        $ret = $ret . '<td>' . $mgroup_name[0] . '</td>';
        $ret = $ret . '<td><img src="images/edit24.png" style="cursor: pointer;" onclick="window.location.href = \'admin_liga_types.php?op=edit&id=' . $id . '\'" /></td>';
        $ret = $ret . '<td align="center"><img src="images/del_icon.png" style="cursor: pointer;" onclick="window.location.href = \'admin_liga_types.php?op=delete&id=' . $id . '\'" /></td>';
        $ret = $ret . '</tr>';
    }
    return $ret . '</table>';
}
开发者ID:robmat,项目名称:samplebator,代码行数:28,代码来源:admin_liga_types.php

示例7: listposts

function listposts(){
	global $db;
	$locality=GETSTR('locality');
	if(!$locality){echo json_encode(array("success"=>"false"));}
	$query="select * from artworks where locality='$locality' order by likes desc";
	$rs=sql_query($query, $db);
	if(!$rs){echo json_encode(array("success:false"));die();}
	$data=array();
	while($myrow=sql_fetch_array($rs)){
		array_push($data, array(
			"artworkid"=>$myrow['artworkid']+0,
			"createdate"=>$myrow['createdate']+0,
			"userid"=>$myrow['userid'],
			"price"=>$myrow['price']+0,
			"likes"=>$myrow['likes']+0,
			"geolat"=>$myrow['geolat']+0,
			"geolong"=>$myrow['geolong']+0,
			"image"=>$myrow['image'],
			"onsale"=>$myrow['onsale']+0,
			"title"=>$myrow['title'],
			"locality"=>$myrow['locality']
		));
	}
	$stats=array("itemcount"=>sql_affected_rows($db,$rs));
	$response=array("data"=>$data, "stats"=>$stats);
	echo json_encode($response);
}
开发者ID:artcrawl,项目名称:artcrawlbackend,代码行数:27,代码来源:listposts.inc.php

示例8: t

 function t($message, $style, $resource_name, $line, $plural = '', $count = 1, $lang = null)
 {
     global $opt, $locale;
     // $locale is for lib1 compatibility
     if ($message == '') {
         return '';
     }
     if ($plural != '' && $count != 1) {
         $message = $plural;
     }
     $search = $this->prepare_text($message);
     $loc = isset($opt['template']['locale']) ? $opt['template']['locale'] : $locale;
     if (!$lang || $lang == $loc) {
         $trans = gettext($search);
     } else {
         // do not use sql_value(), as this is also used from lib1
         $rs = sql("SELECT IFNULL(`sys_trans_text`.`text`, '&3')\n\t\t\t             FROM `sys_trans` \n\t\t\t        LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1'\n\t\t\t\t\t\t\t\t\tWHERE `sys_trans`.`text`='&2' LIMIT 1", $lang, $search, $message);
         if ($r = sql_fetch_array($rs)) {
             $trans = $r[0];
         } else {
             $trans = '';
         }
         sql_free_result($rs);
     }
     // safe w/o mb because asc(%) < 128
     if (strpos($trans, "%") >= 0) {
         $trans = $this->v($trans);
     }
     return $trans;
 }
开发者ID:PaulinaKowalczuk,项目名称:oc-server3,代码行数:30,代码来源:translate.class.php

示例9: getCacheNote

 public function getCacheNote($userid, $cacheid)
 {
     $rs = sql("SELECT id, latitude, longitude, description FROM coordinates WHERE user_id = &1 AND cache_id = &2 AND type = &3", $userid, $cacheid, Coordinate_Type::UserNote);
     $ret = $this->recordToArray(sql_fetch_array($rs));
     mysql_free_result($rs);
     return $ret;
 }
开发者ID:kirstenko,项目名称:oc-server3,代码行数:7,代码来源:Handler.php

示例10: CheckThrottle

function CheckThrottle()
{
    global $opt, $tpl;
    $ip_string = $_SERVER['REMOTE_ADDR'];
    $ip_blocks = mb_split('\\.', $ip_string);
    $ip_numeric = $ip_blocks[3] + $ip_blocks[2] * 256 + $ip_blocks[1] * 65536 + $ip_blocks[0] * 16777216;
    sql('CREATE TABLE IF NOT EXISTS &tmpdb.`sys_accesslog`
        (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `ip` INT UNSIGNED NOT NULL,
         `access_time` TIMESTAMP NOT NULL, INDEX (`access_time`), INDEX (`ip`)) ENGINE = MEMORY');
    $rsStaus = sql("SHOW STATUS LIKE 'Threads_connected'");
    $rStatus = sql_fetch_array($rsStaus);
    sql_free_result($rsStaus);
    if ($rStatus) {
        if ($rStatus[1] > $opt['db']['throttle_connection_count']) {
            $access_count = sql_value("SELECT COUNT(*) FROM &tmpdb.`sys_accesslog` WHERE ip ='&1'", 0, $ip_numeric);
            if ($access_count > $opt['db']['throttle_access_count']) {
                $tpl->error(ERROR_THROOTLE);
            }
        }
    }
    // remove old entries every 100st call
    if (mt_rand(0, 100) == 50) {
        sql("DELETE FROM &tmpdb.`sys_accesslog` WHERE `access_time`<CURRENT_TIMESTAMP()-'&2'", $ip_numeric, $opt['db']['throttle_access_time']);
    }
    sql("INSERT INTO &tmpdb.`sys_accesslog` (`ip`, `access_time`) VALUES ('&1', CURRENT_TIMESTAMP())", $ip_numeric);
}
开发者ID:kratenko,项目名称:oc-server3,代码行数:26,代码来源:throttle.inc.php

示例11: suspendorder

function suspendorder()
{
    testremote();
    $query_a = "select emp_no, trans_no from localtemptrans";
    $db_a = tDataConnect();
    $result_a = sql_query($query_a, $db_a);
    $row_a = sql_fetch_array($result_a);
    $cashier_no = substr("000" . $row_a["emp_no"], -2);
    $trans_no = substr("0000" . $row_a["trans_no"], -4);
    if ($_SESSION["standalone"] == 0) {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $query = "insert " . trim($_SESSION["mServer"]) . "." . trim($_SESSION["mDatabase"]) . ".dbo.suspended select * from localtemptrans";
            $result = sql_query($query, $db_a);
        } else {
            $query = "insert suspended select * from localtemptrans";
            $result = sql_query($query, $db_a);
            if (uploadtable("suspended") == 1) {
                cleartemptrans();
            }
        }
    } else {
        $query = "insert suspended select * from localtemptrans";
        $result = sql_query($query, $db_a);
    }
    $_SESSION["plainmsg"] = "transaction suspended";
    $_SESSION["msg"] = 2;
    receipt("suspended");
    $recall_line = $_SESSION["standalone"] . " " . $_SESSION["laneno"] . " " . $cashier_no . " " . $trans_no;
    gohome();
    sql_close($db_a);
}
开发者ID:WedgeCoop,项目名称:IS4C,代码行数:31,代码来源:special.php

示例12: check_user_level

function check_user_level($user_id)
{
    if (!$user_id) {
        throw new UnexpectedValueException();
    }
    $r = sql_fetch_array(sql_query("SELECT user_rating10, user_level, user_shown_level FROM users WHERE user_id={$user_id} LIMIT 1"));
    $next_level = $r['user_level'];
    if (!$next_level) {
        throw new Exception();
    }
    $last_shown_level = $r['user_shown_level'];
    if ($next_level > $last_shown_level) {
        return $next_level;
    }
    while (true) {
        $points_for_next_level = get_rating4level($next_level);
        if (floor($r['user_rating10'] / 10) >= $points_for_next_level) {
            $next_level++;
            continue;
        }
        break;
    }
    $next_level--;
    if ($next_level == $r['user_level']) {
        return 0;
    }
    return $next_level;
}
开发者ID:ayunah,项目名称:opencorpora,代码行数:28,代码来源:lib_awards.php

示例13: history

/**
*
* 연혁 출력
*
* @param string $his_id
* @param string $skin_dir
* @return string $content
*/
function history($his_id, $skin_dir = '', $group = null)
{
    global $g5;
    $sql = "select * from `{$g5['history_master_table']}` where his_id = '{$his_id}'";
    $history = sql_fetch($sql);
    if (!$skin_dir) {
        $skin_dir = $history['his_skin'];
    }
    $history_skin_path = get_skin_path('history', $skin_dir);
    $history_skin_url = get_skin_url('history', $skin_dir);
    $sortable = "order by his_item_year " . $history['his_sort'] . ', his_item_month ' . $history['his_sort'] . ', his_item_day ' . $history['his_sort'];
    $histories = array();
    $group_histories = array();
    for ($i = $history['his_start_year'], $y = $history['his_end_year']; $i <= $history['his_end_year'], $y >= $history['his_start_year']; $i++, $y--) {
        $history_item = array();
        $conditions = array("his_item_disable = ''", "his_id = '{$his_id}'");
        if (!is_null($group)) {
            $conditions['group'] = "his_group_id = '{$group}'";
        }
        if ($history['his_sort'] == 'asc') {
            $item_year = $i;
        } else {
            $item_year = $y;
        }
        $conditions[] = "his_item_year = '{$item_year}'";
        $condition = count($conditions) > 0 ? 'where ' . implode(' and ', $conditions) : '';
        $sql = "select * from `{$g5['history_item_table']}` {$condition} {$sortable}";
        $result = sql_query($sql);
        while ($item = sql_fetch_array($result)) {
            switch ($history['his_output_type']) {
                case 'a':
                    $item['date'] = $item['his_item_year'] . '.' . $item['his_item_month'] . '.' . $item['his_item_day'];
                    break;
                case 'y':
                    $item['date'] = '';
                    break;
                case 'm':
                    $item['date'] = $item['his_item_month'];
                    break;
                case 'd':
                    $item['date'] = $item['his_item_month'] . '.' . $item['his_item_day'];
                    break;
                case 'i':
                    $item['date'] = $item['his_item_date'];
                    break;
            }
            $history_item[] = $item;
            $all_history_item[] = $item;
        }
        $histories[$item_year] = $history_item;
    }
    $histories = array_filter($histories);
    ob_start();
    include $history_skin_path . '/history.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:66,代码来源:history.extend.php

示例14: get_npas

function get_npas($cache_id)
{
    $rsNPA = sql("SELECT `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName`\n\t             FROM `cache_npa_areas`\n\t       INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id`\n\t       INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id`\n\t            WHERE `cache_npa_areas`.`cache_id`='&1'\n\t         GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\n\t         ORDER BY `npa_types`.`ordinal` ASC", $cache_id);
    $npas = array();
    while ($rNPA = sql_fetch_array($rsNPA)) {
        $npas[] = $rNPA;
    }
    sql_free_result($rsNPA);
    return $npas;
}
开发者ID:4Vs,项目名称:oc-server3,代码行数:10,代码来源:npas.inc.php

示例15: getChildWps

 public function getChildWps($cacheid)
 {
     $rs = sql("SELECT id, cache_id, subtype, latitude, longitude, description FROM coordinates WHERE cache_id = &1 AND type = &2", $cacheid, Coordinate_Type::ChildWaypoint);
     $ret = array();
     while ($r = sql_fetch_array($rs)) {
         $ret[] = $this->recordToArray($r);
     }
     mysql_free_result($rs);
     return $ret;
 }
开发者ID:RH-Code,项目名称:opencaching,代码行数:10,代码来源:Handler.php


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