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


PHP cls_mysql::fetch_array方法代码示例

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


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

示例1: elseif

} elseif ($step == 'start') {
    $limit = getgpc('limit', 'P');
    $update = getgpc('update', 'P');
    $insert = getgpc('insert', 'P');
    $success = getgpc('success', 'P');
    $error = getgpc('error', 'P');
    $item_num = 500; // 姣忔?澶勭悊1000涓?細鍛樻暟鎹
    $statistics = array('update' => 0, 'insert' => 0, 'success' => 0, 'error' => 0);
    if (empty($limit)) {
        $limit = 0;
    }
    $uc_db = new cls_mysql(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, 0, 1);
    $total_members = $uc_db->getOne("SELECT COUNT(*) FROM ". UC_DBTABLEPRE ."members");
    $sql = "SELECT uid, username, password, email, salt FROM ". UC_DBTABLEPRE ."members ORDER BY uid ASC LIMIT $limit, $item_num";
    $uc_query = $uc_db->query($sql);
    while($member = $uc_db->fetch_array($uc_query)){
        $user_exists = $db->getOne("SELECT COUNT(*) FROM {$prefix}users WHERE `user_name`='{$member['username']}'");
        if (!$user_exists) {
            $sql = "INSERT INTO {$prefix}users (`email`, `user_name`, `password`, `salt`) VALUES('{$member['email']}', '{$member['username']}', '{$member['password']}', '2{$member['salt']}')";
            ++$statistics['insert'];
        } else {
            $sql = "UPDATE {$prefix}users SET `password`='{$member['password']}', `salt`='2{$member['salt']}' WHERE `user_name`='{$member['username']}'";
            ++$statistics['update'];
        }
        $db->query($sql);
        if ($db->affected_rows() > 0) {
            ++$statistics['success'];
        } else {
            ++$statistics['error'];
        }
    }
开发者ID:noikiy,项目名称:mdwp,代码行数:31,代码来源:ucimport.php

示例2: foreach

 foreach ($dsidsarr as $k => $v) {
     $filterbox .= "<option value=\"{$k}\"" . ($dsid == $k ? ' selected' : '') . ">{$v}</option>";
 }
 $filterbox .= "</select>";
 $filterbox .= '&nbsp; &nbsp; &nbsp; ' . lang('choose_table') . '&nbsp; &nbsp;';
 $filterbox .= "<select style=\"vertical-align: middle;\" name=\"dbtable\" onchange=\"redirect('?entry=dbsources&action=viewconfigs&dsid={$dsid}&dbtable=' + this.options[this.selectedIndex].value);\">";
 foreach ($dbtables as $k => $v) {
     $filterbox .= "<option value=\"{$k}\"" . ($dbtable == $k ? ' selected' : '') . ">{$v}</option>";
 }
 $filterbox .= "</select>";
 tabheader($filterbox);
 tabfooter();
 $tblfields = array();
 if ($dbtable) {
     $query = $ndb->query("SHOW FULL COLUMNS FROM {$dbtable}", 'SILENT');
     while ($row = $ndb->fetch_array($query)) {
         $types = explode(' ', $row['Type']);
         $tblfields[$row['Field']] = strtolower($types[0]);
     }
 }
 tabheader(lang('create_query_string'), 'dbsqlstr', "?entry=dbsources&action=viewconfigs&dsid={$dsid}&dbtable={$dbtable}", 8);
 trcategory(array(lang('sn'), lang('field_name'), lang('field_type'), '<input class="checkbox" type="checkbox" name="chkall" onclick="checkall(this.form)">' . lang('choose'), lang('query_mode'), lang('value'), lang('order'), lang('order_prior')));
 $i = 1;
 $orderarr = array('' => '', 'ASC' => lang('asc'), 'DESC' => lang('desc'));
 $dbtypearr = array(1 => array('text', 'mediumtext', 'longtext', 'char', 'varchar', 'tinytext'), 2 => array('tinyint', 'smallint', 'int', 'mediumint', 'bigint', 'float', 'double', 'decimal', 'bit', 'bool', 'binary'));
 $modearr = array('=' => 0, '>' => 1, '>=' => 1, '<' => 1, '<=' => 1, '!=' => 0, 'LIKE' => 0, 'NOT LIKE' => 0, 'LIKE %...%' => 2, 'LIKE %...' => 2, 'LIKE ...%' => 2, 'REGEXP' => 2, 'NOT REGEXP' => 2, 'IS NULL' => 0, 'IS NOT NULL' => 0);
 foreach ($tblfields as $k => $v) {
     echo "<tr class=\"txt\">" . "<td class=\"txtC w30\">{$i}</td>\n" . "<td class=\"txtL\"><b>{$k}</b></td>\n" . "<td class=\"txtL\">{$v}</td>\n" . "<td class=\"txtC w45\"><input class=\"checkbox\" type=\"checkbox\" name=\"dbnews[{$k}][adopt]\" value=\"1\"" . (empty($dbnews[$k]['adopt']) ? '' : ' checked') . ">\n" . "<td class=\"txtC\"><select style=\"vertical-align: middle;\" name=\"dbnews[{$k}][mode]\">" . makeoption(thismodearr($v), empty($dbnews[$k]['mode']) ? '' : $dbnews[$k]['mode']) . "</select></td>\n" . "<td class=\"txtC\"><input type=\"text\" size=\"20\" name=\"dbnews[{$k}][value]\" value=\"" . (empty($dbnews[$k]['value']) ? '' : mhtmlspecialchars(stripslashes($dbnews[$k]['value']))) . "\"></td>\n" . "<td class=\"txtC w50\"><select style=\"vertical-align: middle;\" name=\"dbnews[{$k}][order]\">" . makeoption($orderarr, empty($dbnews[$k]['order']) ? '' : $dbnews[$k]['order']) . "</select></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"dbnews[{$k}][prior]\" value=\"" . (empty($dbnews[$k]['prior']) ? 0 : mhtmlspecialchars(stripslashes($dbnews[$k]['prior']))) . "\"></td>\n" . "</tr>";
     $i++;
 }
 tabfooter('bdbsqlstr', lang('create'));
开发者ID:polarlight1989,项目名称:08cms,代码行数:31,代码来源:dbsources.inc.php


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