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


PHP mysql::fetch_array方法代码示例

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


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

示例1: go_page

 /**
  * page main code
  */
 function go_page()
 {
     if ($this->page != "") {
         $reslut = mysql::fn_select($this->table, 'count(*) as `total`', $this->condition, '', $this->limit);
         $rs = mysql::fetch_array($reslut);
         $message_count = $rs['total'];
         //get the messages's count number
         $page_count = ceil($message_count / $this->page_size);
         //get the page's count number
         $offset = ($this->page - 1) * $this->page_size;
         //get the first value of sql's limit
         if ($message_count <= $this->page_size) {
             $page_code = array("", "", "", "");
         } else {
             if ($this->page == 1) {
                 $page_code = array("", "", "<A name=code href=" . $this->href . "?page=" . ($this->page + 1) . "&action=" . $this->action_value . "&" . $this->url_value . ">下一页</a>", "<A name=code href=" . $this->href . "?page=" . $page_count . "&action=" . $this->action_value . "&" . $this->url_value . ">尾页</a>");
             } else {
                 if ($this->page == $page_count) {
                     $page_code = array("<A name='code' href=" . $this->href . "?page=1&action=" . $this->action_value . "&" . $this->url_value . ">首页</a>", "<A name='code' href=" . $this->href . "?page=" . ($this->page - 1) . "&action=" . $this->action_value . "&" . $this->url_value . ">上一页</a>", "", "");
                 } else {
                     $page_code = array("<A name='code' href=" . $this->href . "?page=1&action=" . $this->action_value . "&" . $this->url_value . ">首页</a>", "<A name='code' href=" . $this->href . "?page=" . ($this->page - 1) . "&action=" . $this->action_value . "&" . $this->url_value . ">上一页</a>", "<A name='code' href=" . $this->href . "?page=" . ($this->page + 1) . "&action=" . $this->action_value . "&" . $this->url_value . ">下一页</a>", "<A name='code' href=" . $this->href . "?page=" . $page_count . "&action=" . $this->action_value . "&" . $this->url_value . ">尾页</a>");
                 }
             }
         }
         $page_info = array("message_count" => $message_count, "page_count" => $page_count, "offset" => $offset, "page_size" => $this->page_size, "page_now" => $this->page, "page_first" => $page_code[0], "page_up" => $page_code[1], "page_next" => $page_code[2], "page_one_last" => $page_code[3]);
         return $page_info;
     }
 }
开发者ID:rick00young,项目名称:rick-s-php,代码行数:31,代码来源:page_class.php

示例2: select

 /**
  * SELECT
  */
 public function select()
 {
     $select_sql = 'SELECT {FIELD} FROM {TABLE}{WHERE}{GROUP}{HAVING}{ORDER}{LIMIT}';
     $this->sql = str_replace(array('{TABLE}', '{FIELD}', '{WHERE}', '{GROUP}', '{HAVING}', '{ORDER}', '{LIMIT}'), array($this->_parseTable(), $this->_parseField(), $this->_parseWhere(), $this->_parseGroup(), $this->_parseHaving(), $this->_parseOrder(), $this->_parseLimit()), $select_sql);
     $data = array();
     $query = $this->query($this->sql);
     $key = $this->_parseKey();
     while ($row = $this->db->fetch_array($query)) {
         if ($key) {
             $data[$row[$key]] = $row;
         } else {
             $data[] = $row;
         }
     }
     return $data;
 }
开发者ID:baiy,项目名称:mysql_slow_query_log_import_db,代码行数:19,代码来源:Mysql.php

示例3: synlogin

 function synlogin($user)
 {
     global $timestamp, $uc_key;
     list($winduid, $windid, $windpwd) = explode("\t", $this->base->strcode($user, false));
     header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
     require_once "../../config/db.config.php";
     require_once "../../app/include/mysql.class.php";
     require_once "../../app/include/public.function.php";
     require_once "../../data/plus/config.php";
     $ip = fun_ip_get();
     $time = time();
     if ($config[sy_pw_type] == "pw_center") {
         $db = new mysql($db_config['dbhost'], $db_config['dbuser'], $db_config['dbpass'], $db_config['dbname'], ALL_PS, $db_config['charset']);
         $user_query = $db->query("SELECT * FROM {$db_config['def']}member WHERE `username`='{$windid}'");
         while ($userrs = $db->fetch_array($user_query)) {
             $userinfo = $userrs;
         }
         //判断是否是重名用户
         if ($userinfo["uid"] > 0) {
             if ($userinfo["pw_repeat"] != "1") {
                 //判断账户名密码是否一致
                 if ($userinfo["password"] == md5($windpwd . $userinfo[salt])) {
                     $db->query("UPDATE {$db_config['def']}member SET `pwuid`='{$winduid}' WHERE `uid`='{$userinfo['uid']}'");
                     $this->unset_cookie();
                     $this->add_cookie($userinfo[uid], $userinfo[username], $userinfo[salt], $userinfo[email], $userinfo[password]);
                 } else {
                     //不一致标注为重名用户
                     $db->query("UPDATE {$db_config['def']}member SET `pw_repeat`='1' WHERE `uid`='{$userinfo['uid']}'");
                 }
             }
         } else {
             //用户不存在 新建一个用户
             $salt = substr(uniqid(rand()), -6);
             $pass = md5($windpwd . $salt);
             $db->query("INSERT INTO {$db_config['def']}member SET `username`='{$windid}',`password`='{$pass}',`salt`='{$salt}',`usertype`='1',`reg_ip`='{$ip}',`reg_date`='{$time}',`pwuid`='{$winduid}'");
             $uid = $db->insert_id();
             $db->query("INSERT INTO {$db_config['def']}resume SET `uid`='" . $uid . "'");
             $db->query("INSERT INTO {$db_config['def']}member_statis SET `uid`='" . $uid . "'");
             $this->unset_cookie();
             $this->add_cookie($winduid, $windid, $salt, "", $pass);
         }
     }
 }
开发者ID:justinyaoqi,项目名称:qyhr,代码行数:43,代码来源:class_User.php

示例4: ltrim

     $wheresql .= " AND experience={$experience} ";
 }
 if ($nature != '') {
     $wheresql .= " AND nature={$nature} ";
 }
 if ($scale != '') {
     $wheresql .= " AND scale={$scale} ";
 }
 if (!empty($wheresql)) {
     $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
     $wheresql .= " AND map_x!='' AND map_y!='' ";
 }
 $id = array();
 if (!empty($lng) && !empty($lat)) {
     $idresult = $db->query("SELECT id , ROUND(6378.138*2*ASIN(SQRT(POW(SIN((" . $lat . "*PI()/180-map_y*PI()/180)/2),2)+COS(" . $lat . "*PI()/180)*COS(map_y*PI()/180)*POW(SIN((" . $lng . "*PI()/180-map_x*PI()/180)/2),2)))*1000) AS juli FROM {$jobstable} " . $wheresql . " ORDER BY juli ASC   LIMIT {$offset},{$rows}");
     while ($row = $db->fetch_array($idresult)) {
         $id[] = $row['id'];
     }
 }
 if (!empty($id)) {
     $wheresql = " WHERE id IN (" . implode(',', $id) . ") ";
     $sql = "SELECT *, ROUND(6378.138*2*ASIN(SQRT(POW(SIN((" . $lat . "*PI()/180-map_y*PI()/180)/2),2)+COS(" . $lat . "*PI()/180)*COS(map_y*PI()/180)*POW(SIN((" . $lng . "*PI()/180-map_x*PI()/180)/2),2)))*1000) AS juli FROM " . table('jobs') . $wheresql . "  ORDER BY juli ASC , stick DESC , refreshtime DESC ";
     $jobs_list = $db->getall($sql);
     foreach ($jobs_list as $key => $value) {
         $jobs_list[$key]["juli"] = distancerange($value["juli"]);
     }
 } else {
     $jobs_list = array();
 }
 $smarty->assign('jobs', $jobs_list);
 $smarty->assign('goback', $_SERVER["HTTP_REFERER"]);
开发者ID:winiceo,项目名称:job,代码行数:31,代码来源:jobs-near-list.php

示例5: getPicUrl

<?php

include "config/config.php";
include "common/mysql.class.php";
$db = new mysql($mydbhost, $mydbuser, $mydbpw, $mydbname, $mydbcharset);
session_start();
$username = $_SESSION['username'];
$uid = $_SESSION['uid'];
$confsql = "select sitename,ensitename,keywords,enkeywords,des,endes,title,entitle from `th_config` where id=1";
$confquery = $db->query($confsql);
$confrow = $db->fetch_array($confquery);
define('INDTITLE', $confrow['title']);
define('SN', $confrow['sitename']);
define('KW', $confrow['keywords']);
define('DES', $confrow['des']);
define('ENINDTITLE', $confrow['entitle']);
define('ENSN', $confrow['ensitename']);
define('ENKW', $confrow['enkeywords']);
define('ENDES', $confrow['endes']);
function getPicUrl($picId)
{
    global $db;
    $sql = "select url from `th_uploads` where id=" . $picId;
    $query = $db->query($sql);
    $row = $db->fetch_array($query);
    return $url = $row['url'];
}
function getPicThumb($picId)
{
    global $db;
    $sql = "select thumb from `th_uploads` where id=" . $picId;
开发者ID:howareyoucolin,项目名称:demo,代码行数:31,代码来源:global.php

示例6: session

require ROOT_PATH . '/inc/mysql.class.php';
require ROOT_PATH . '/inc/global.func.php';
include ROOT_PATH . '/inc/session.class.php';
include ROOT_PATH . '/inc/xml.class.php';
include_once ROOT_PATH . '/inc/Taoapi.php';
//初始化session
$session = new session();
if ($_REQUEST) {
    $_REQUEST['sid'] = $session->get_id();
}
//初始化数据连接
$db = new mysql();
$db->connect($dbhost, $dbuser, $dbpw, $dbname);
if (!checkfile('setting', 0)) {
    $query = $db->query('select variable,content from ' . tname('setting'));
    while ($rows = $db->fetch_array($query)) {
        $setting[$rows['variable']] = $rows['content'];
    }
    //网站类型设定
    $setting['sitelogType'] = array(1 => '网购商城', 2 => '名站导航', 3 => '团购网站', 4 => '综合平台');
    write('setting', $setting);
} else {
    $setting = read('setting');
}
/*--------------------系统变量--------------------------*/
define('TPLDIR', !empty($_GET['tplview']) ? $_GET['tplview'] : ($setting['site_template_dir'] ? $setting['site_template_dir'] : 'default'));
define("SITE_ROOT", 'http://' . str_replace('://', '', str_replace('http', '', $setting['site_url'])));
define('VERSION', 'KaKa101_zidan v1.1');
$timezone = 'Asia/Shanghai';
$timestamp = time();
$tplrefresh = 5;
开发者ID:BGCX261,项目名称:zidan-kaka-oneplusone-svn-to-git,代码行数:31,代码来源:common.inc.php

示例7: synlogin

 function synlogin($get, $post)
 {
     if (!API_SYNLOGIN) {
         return API_RETURN_FORBIDDEN;
     }
     header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
     require_once "../../data/db.config.php";
     require_once "../../include/mysql.class.php";
     require_once "../../include/public.function.php";
     require_once "../../plus/config.php";
     $ip = fun_ip_get();
     $time = time();
     if ($config[sy_uc_type] == "uc_center") {
         $db = new mysql($db_config['dbhost'], $db_config['dbuser'], $db_config['dbpass'], $db_config['dbname'], ALL_PS, $db_config['charset']);
         $user_query = $db->query("SELECT * FROM {$db_config['def']}member WHERE `username`='{$get['username']}'");
         while ($userrs = $db->fetch_array($user_query)) {
             $userinfo[] = $userrs;
         }
         if ($config[sy_onedomain] != "") {
             $weburl = str_replace("http://www", "", $config[sy_onedomain]);
         } elseif ($config[sy_indexdomain] != "") {
             $weburl = str_replace("http://www", "", $config[sy_indexdomain]);
         } else {
             $weburl = str_replace("http://www", "", $config[sy_weburl]);
         }
         if (is_array($userinfo)) {
             $uid = $userinfo[0][uid];
             $certokquery = $db->query("SELECT * FROM {$db_config['def']}company_cert where `uid`='{$uid} ' and `type`='1'");
             while ($certrow = $db->fetch_array($certokquery)) {
                 $certstatus = $certrow[status];
             }
             if ($userinfo[0][username] == $get[username] && $userinfo[0][name_repeat] != "1") {
                 $this->unset_cookie($weburl);
                 if ($userinfo[0][password] == $get[password]) {
                     if ($certstatus == "1" || $config[user_status] != "1" || $userinfo[0][usertype] == "2") {
                         $this->add_cookie($weburl, $userinfo[0][uid], $userinfo[0][username], $userinfo[0][salt], $userinfo[0][email], $userinfo[0][password], $userinfo[0][usertype]);
                     }
                 } else {
                     $db->query("UPDATE {$db_config['def']}member SET `password`='{$get['password']}',`email`='{$get['email']}',`salt`='{$get['salt']}' WHERE `uid`='{$uid}'");
                     if ($certstatus == "1" || $config[user_status] != "1") {
                         $this->add_cookie($weburl, $userinfo[0][uid], $userinfo[0][username], $get[salt], $get[email], $get[password], $userinfo[0][usertype]);
                     }
                 }
                 $db->query("UPDATE {$db_config['def']}member SET `login_ip`='{$ip}',`login_date`='{$time}',`login_hits`=`login_hits`+1 where `uid`='{$uid}'");
             }
         } else {
             $db->query("INSERT INTO {$db_config['def']}member SET `username`='{$get['username']}',`password`='{$get['password']}',`email`='{$get['email']}',`salt`='{$get['salt']}',`usertype`='1',`reg_ip`='{$ip}',`reg_date`='{$time}'");
             $uid = $db->insert_id();
             $db->query("INSERT INTO {$db_config['def']}resume SET `uid`='" . $uid . "'");
             $db->query("INSERT INTO {$db_config['def']}member_statis SET `uid`='" . $uid . "'");
             $randstr = rand(10000000, 99999999);
             $db->query("INSERT INTO {$db_config['def']}company_cert SET `status`='0',`step`='1',`check`='{$get['email']}',`check2`='{$randstr}',`ctime`='" . mktime() . "',`type`='1',`uid`='" . $uid . "'");
             $this->unset_cookie($weburl);
             if ($config[user_status] != "1") {
                 $this->add_cookie($weburl, $uid, $get[username], $get[salt], $get[email], $get[password]);
             }
         }
     }
 }
开发者ID:keyu199314,项目名称:php,代码行数:59,代码来源:uc.php

示例8: intval

    $smarty->cache = true;
    $smarty->cache_lifetime = $mypage['caching'];
} else {
    $smarty->cache = false;
}
$cached_id = $alias . (isset($_GET['id']) ? "|" . intval($_GET['id']) % 100 . '|' . intval($_GET['id']) : '') . (isset($_GET['page']) ? "|p" . intval($_GET['page']) % 100 : '');
require_once QISHI_ROOT_PATH . 'include/mysql.class.php';
$db = new mysql($dbhost, $dbuser, $dbpass, $dbname);
//统计测评类型参与人数
$sql = "SELECT *  FROM " . table('evaluation_type') . " ";
$type_info = $db->getall($sql);
foreach ($type_info as $key => $value) {
    $num = 0;
    $sql_num = "SELECT * FROM " . table('evaluation_paper') . " WHERE type_id=" . $value['id'];
    $type_num = $db->query($sql_num);
    while ($row = $db->fetch_array($type_num)) {
        $num = $num + intval($row['join_num']);
    }
    $type_info[$key]['join_num'] = $num;
}
//热门测评
$paper_sql = "SELECT * FROM " . table('evaluation_paper') . " ORDER BY join_num LIMIT 10 ";
$paper_info = $db->getall($paper_sql);
foreach ($paper_info as $key => $value) {
    $paper_info[$key]['key'] = $key + 1;
}
$smarty->assign('type_info', $type_info);
$smarty->assign('paper_info', $paper_info);
if (!$smarty->is_cached($mypage['tpl'], $cached_id)) {
    require_once QISHI_ROOT_PATH . 'include/mysql.class.php';
    $db = new mysql($dbhost, $dbuser, $dbpass, $dbname);
开发者ID:winiceo,项目名称:job,代码行数:31,代码来源:index.php

示例9: synlogin

 function synlogin($get, $post)
 {
     if (!API_SYNLOGIN) {
         return API_RETURN_FORBIDDEN;
     }
     header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
     //TODO:暂时不知道如何改成PLUS_PATH
     require_once $this->appdir . "config/db.config.php";
     require_once $this->appdir . "app/include/mysql.class.php";
     require_once $this->appdir . "app/include/public.function.php";
     require_once dirname(dirname(dirname(__FILE__))) . "/data/plus/config.php";
     //$ip = fun_ip_get();
     $time = time();
     if ($config[sy_uc_type] == "uc_center") {
         $db = new mysql($db_config['dbhost'], $db_config['dbuser'], $db_config['dbpass'], $db_config['dbname'], ALL_PS, $db_config['charset']);
         $user_query = $db->query("SELECT * FROM {$db_config['def']}member WHERE `username`='{$get['username']}'");
         while ($userrs = $db->fetch_array($user_query)) {
             $userinfo[] = $userrs;
         }
         if ($config[sy_onedomain] != "") {
             $weburl = "." . $config[sy_onedomain];
         } else {
             $weburl = str_replace("http://www", "", $config[sy_weburl]);
         }
         if (is_array($userinfo)) {
             $uid = $userinfo[0][uid];
             $certokquery = $db->query("SELECT * FROM {$db_config['def']}company_cert where `uid`='{$uid} ' and `type`='1'");
             while ($certrow = $db->fetch_array($certokquery)) {
                 $certstatus = $certrow[status];
             }
             //$pass = md5($userinfo[0][password].$get[salt]);
             if ($userinfo[0][username] == $get[username] && $userinfo[0][name_repeat] != "1") {
                 $this->unset_cookie($weburl);
                 if ($userinfo[0][password] == $get[password]) {
                     if ($certstatus == "1" || $config[user_status] != "1" || $userinfo[0][usertype] == "2") {
                         $this->add_cookie($weburl, $userinfo[0][uid], $userinfo[0][username], $userinfo[0][salt], $userinfo[0][email], $userinfo[0][password], $userinfo[0][usertype]);
                     }
                 } else {
                     $db->query("UPDATE {$db_config['def']}member SET `password`='{$get['password']}',`email`='{$get['email']}',`salt`='{$get['salt']}' WHERE `uid`='{$uid}'");
                     if ($certstatus == "1" || $config[user_status] != "1") {
                         $this->add_cookie($weburl, $userinfo[0][uid], $userinfo[0][username], $get[salt], $get[email], $get[password], $userinfo[0][usertype]);
                     }
                 }
                 $db->query("UPDATE {$db_config['def']}member SET `login_ip`='{$ip}',`login_date`='{$time}',`login_hits`=`login_hits`+1 where `uid`='{$uid}'");
             }
         } else {
             //创建用户但是无会员身份(usertype)
             $db->query("INSERT INTO {$db_config['def']}member SET `username`='{$get['username']}',`password`='{$get['password']}',`email`='{$get['email']}',`salt`='{$get['salt']}',`reg_ip`='{$ip}',`reg_date`='{$time}',`usertype`='0'");
             $uid = $db->insert_id();
         }
     }
 }
开发者ID:justinyaoqi,项目名称:qyhr,代码行数:52,代码来源:uc.php


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