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


PHP createtable函数代码示例

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


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

示例1: runquery

function runquery($sql)
{
    global $lang, $dbcharset, $tblprefix, $db;
    $sql = str_replace("\r", "\n", str_replace(' {$tblprefix}', ' ' . $tblprefix, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        $ret[$num] = '';
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                $db->query(createtable($query, $dbcharset));
            } else {
                $db->query($query);
            }
        }
    }
}
开发者ID:polarlight1989,项目名称:08cms,代码行数:27,代码来源:update.fun.php

示例2: runquery

function runquery($sql)
{
    global $dbcharset, $DBS;
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                //echo '创建表 '.$name.' ... 成功<br />';
                $DBS->query(createtable($query, $dbcharset));
            } else {
                $DBS->query($query);
            }
        }
    }
}
开发者ID:power12317,项目名称:Youbbs-Openshift2,代码行数:27,代码来源:install.php

示例3: runquery

function runquery($sql)
{
    global $lvyi_db;
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    $strtip = "";
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE\\s*([a-z0-9_]+)\\s*.*/is", "\\1", $query);
                $res = $lvyi_db->runSql(createtable($query, 'utf8'));
                $tablenum++;
            } else {
                $res = $lvyi_db->runSql($query);
            }
        }
    }
    return true;
}
开发者ID:RX78NY1,项目名称:hustoj,代码行数:29,代码来源:install.php

示例4: runquery

function runquery($sql)
{
    global $db_prefix, $DB, $tablenum;
    $sql = str_replace("\r", "\n", str_replace(' sablog_', ' ' . $db_prefix, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        $ret[$num] = '';
        foreach ($queries as $query) {
            if ($query) {
                $ret[$num] .= $query[0] == '#' ? '' : $query;
            }
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                echo '创建表 ' . $name . ' ... <font color="#0000EE">成功</font><br />';
                $DB->query(createtable($query));
                $tablenum++;
            } else {
                $DB->query($query);
            }
        }
    }
}
开发者ID:BGCX261,项目名称:zjnewcitycode-svn-to-git,代码行数:31,代码来源:upgrade.php

示例5: runquery

function runquery($sql)
{
    global $_G;
    $tablepre = $_G['config']['db'][1]['tablepre'];
    $dbcharset = $_G['config']['db'][1]['dbcharset'];
    $sql = str_replace(array(' dzz_', ' `dzz_', ' cdb_', ' `cdb_', ' pre_', ' `pre_'), array(' {tablepre}', ' `{tablepre}', ' {tablepre}', ' `{tablepre}', ' {tablepre}', ' `{tablepre}'), $sql);
    $sql = str_replace("\r", "\n", str_replace(array(' {tablepre}', ' `{tablepre}'), array(' ' . $tablepre, ' `' . $tablepre), $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                DB::query(createtable($query, $dbcharset));
            } else {
                DB::query($query);
            }
        }
    }
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:29,代码来源:function_admin.php

示例6: runquery

function runquery($sql)
{
    global $dbcharset, $tbl, $db;
    $tablepre = $tbl . 'bot_';
    $sql = str_replace("\r", "\n", str_replace(' onez_', ' ' . $tablepre, $sql));
    $ret = array();
    $num = 0;
    if ($dbcharset == 'utf8') {
        @$db->query("set names {$dbcharset}");
    }
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                $db->query(createtable($query));
            } else {
                if ($dbcharset == 'utf8') {
                    $query = iconv('gbk', $dbcharset, $query);
                }
                $db->query($query);
            }
        }
    }
}
开发者ID:shenhua4286,项目名称:gxw,代码行数:33,代码来源:save.php

示例7: runquery

function runquery($sql, $showmessage = TRUE)
{
    global $db;
    $dbcharset = "utf8";
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            @($ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query);
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE IF NOT EXISTS ([a-z0-9_]+) .*/is", "\\1", $query);
                $showmessage && showjsmessage('建立数据表 ' . $name . ' ... 成功!');
                $db->query(createtable($query, $dbcharset));
            } else {
                $db->query($query);
            }
        }
    }
}
开发者ID:kbglobal51,项目名称:yii-trackstar-sample,代码行数:28,代码来源:install.func.php

示例8: runquery

function runquery($query)
{
    global $db;
    $query = str_replace("\r", "\n", str_replace('ask_', DB_TABLEPRE, $query));
    $expquery = explode(";\n", $query);
    foreach ($expquery as $sql) {
        $sql = trim($sql);
        if ($sql == '' || $sql[0] == '#') {
            continue;
        }
        if (strtoupper(substr($sql, 0, 12)) == 'CREATE TABLE') {
            $db->query(createtable($sql, DB_CHARSET));
        } else {
            $db->query($sql);
        }
    }
}
开发者ID:source-hunter,项目名称:tipask,代码行数:17,代码来源:upgrade1.3.php

示例9: sql_run

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
function sql_run($sql, $default_table_prefix = 'pb_')
{
    global $dbcharset, $tb_prefix;
    $return = false;
    if (mysql_get_server_info() > '4.1' && $dbcharset) {
        $sql = preg_replace("/TYPE=(InnoDB|MyISAM)( DEFAULT CHARSET=[^; ]+)?/", "TYPE=\\1 DEFAULT CHARSET=" . $dbcharset, $sql);
    }
    if ($tb_prefix != $default_table_prefix) {
        $sql = str_replace($tb_prefix, $default_table_prefix, $sql);
        $sql = str_replace($default_table_prefix, $tb_prefix, $sql);
    }
    $sql = str_replace("\r", "\n", $sql);
    $sql_content = array();
    $intRunTimes = 0;
    $arrQuery = explode(";\n", trim($sql));
    unset($sql);
    foreach ($arrQuery as $query) {
        $sql_content[$intRunTimes] = '';
        $tmpQuery = explode("\n", trim($query));
        $tmpQuery = array_filter($tmpQuery);
        foreach ($tmpQuery as $query) {
            $str1 = substr($query, 0, 1);
            if ($str1 != '#' && $str1 != '-') {
                $sql_content[$intRunTimes] .= $query;
            }
        }
        $intRunTimes++;
    }
    if (is_array($sql_content) && !empty($sql_content)) {
        foreach ($sql_content as $sql) {
            if (trim($sql) != '') {
                if (substr($sql, 0, 12) == 'CREATE TABLE') {
                    $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $sql);
                    $return = mysql_query(createtable(stripslashes(trim($sql)), $dbcharset));
                } else {
                    $return = mysql_query(stripslashes(trim($sql)));
                }
            }
        }
    } else {
        $return = mysql_query(stripslashes($sql_content));
    }
    return $return;
}
开发者ID:haojielyb,项目名称:phpb2b,代码行数:50,代码来源:func.sql.php

示例10: runquery

function runquery($sql, $tablepre, $db)
{
    global $lang, $tablepre, $db;
    require_once 'install_lang.php';
    if (!isset($sql) || empty($sql)) {
        return;
    }
    $orig_tablepre = "keke_";
    $sql = str_replace("\r", "\n", str_replace(' ' . $orig_tablepre, ' ' . $tablepre, $sql));
    $sql = str_replace("\r", "\n", str_replace(' `' . $orig_tablepre, ' `' . $tablepre, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $ret[$num] = '';
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= isset($query[0]) && $query[0] == '#' || isset($query[1]) && isset($query[1]) && $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        $info = '';
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                $name = preg_replace("/CREATE TABLE \\`([a-z0-9_]+)\\` .*/is", "\\1", $query);
                showjsmessage($lang['create_table'] . ' ' . $name . ' ... ' . $lang['succeed']);
                $db->query(createtable($query));
            } else {
                $db->query($query);
            }
            $info .= $query . "\n";
        }
    }
    return $info;
}
开发者ID:xupnge1314,项目名称:project,代码行数:37,代码来源:install_function.php

示例11: runquery

function runquery($sql)
{
    global $db, $tablenum;
    $sql = str_replace("\r", "\n", str_replace('#iCMS@__', DB_PREFIX, $sql));
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 12) == 'CREATE TABLE') {
                preg_match("|CREATE TABLE (.*) \\(  |i", $query, $name);
                flush();
                echo '创建表 ' . $name[1] . ' ... <font color="#0000EE">成功</font><br />';
                flush();
                iCMS_DB::query(createtable($query, DB_CHARSET));
                $tablenum++;
            } else {
                iCMS_DB::query($query);
            }
        }
    }
}
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:30,代码来源:install.php

示例12: array

 $setting = !empty($setting) ? $setting : array();
 $missingtable = !empty($missingtable) ? $missingtable : array();
 $repairtable = is_array($repairtable) && !empty($repairtable) ? $repairtable : array();
 if ($_POST['repairsubmit'] && (!empty($repair) || !empty($setting) || !empty($repairtable) || !empty($missingtable))) {
     $error = '';
     $errorcount = 0;
     $alter = $fielddefault = array();
     foreach ($missingtable as $value) {
         if (!isset($installdata)) {
             $fp = fopen($dbsql, "rb");
             $installdata = fread($fp, filesize($dbsql));
             $installdata = str_replace("\r", "\n", str_replace(' sablog_', ' ' . $db_prefix, $installdata));
             fclose($fp);
         }
         preg_match("/CREATE TABLE " . $db_prefix . $value . "\\s+\\(.+?;/is", $installdata, $a);
         $DB->query(createtable($a[0]));
     }
     foreach ($repair as $table => $valuedata) {
         foreach ($valuedata as $value) {
             echo print_r($value);
             echo '<br>';
             if (!in_array($r_table, $repairtable)) {
                 list($r_table, $r_field, $option) = explode('|', $value);
                 if (!isset($repairrtable[$r_table]) && ($fieldsquery = $DB->query("SHOW FIELDS FROM {$db_prefix}{$r_table}", 'SILENT'))) {
                     while ($fields = $DB->fetch_array($fieldsquery)) {
                         $fielddefault[$r_table][$fields['Field']] = $fields['Default'];
                     }
                 }
                 $field = $saxdb[$r_table][$r_field];
                 $altersql = '`' . $field['Field'] . '` ' . $field['Type'];
                 $altersql .= $field['Null'] == 'NO' ? ' NOT NULL' : '';
开发者ID:BGCX261,项目名称:zjnewcitycode-svn-to-git,代码行数:31,代码来源:check.php

示例13: runquery

function runquery($sqlfile, $DB, $db_prefix, $tablenum = '0', $dbcharset)
{
    $sqlfile = "install.sql";
    $sql = getsql($sqlfile);
    $sql = str_replace("\r", "\n", str_replace('yxb_', ' ' . $db_prefix, $sql));
    //替换表前缀
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        //以";\n"分割sql
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' ? '' : $query;
            //把#开头的行当作注释
        }
        $num++;
    }
    unset($sql);
    //销毁变量
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
            if (substr($query, 0, 6) == 'CREATE') {
                //语句前面12割字符是CREATE TABLE
                $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                //CREATE TABLE后面紧接着的a到z,0到9范围内字符组成的字符串第一次匹配当作表名
                echo '<font color="#0f0dEE"></font>创建表 ' . $name . ' .................................................................................................................................................................... <font color="#0000EE">成功</font><br />';
                $DB->query(createtable($query, $dbcharset));
                //调用createtable函数
                $tablenum++;
                //表的数量增加
            } else {
                $DB->query($query);
                //不是CREATE TABLE语句则调用query方法直接执行
            }
        }
    }
}
开发者ID:BGCX261,项目名称:zlskytakeorder-svn-to-git,代码行数:38,代码来源:ins_lib.php

示例14: runquery

function runquery($query) {
	global $db;

	$query = str_replace("\r", "\n", str_replace(' uc_', ' '.UC_DBTABLEPRE, $query));
	$expquery = explode(";\n", $query);
	foreach($expquery as $sql) {
		$sql = trim($sql);
		if($sql == '' || $sql[0] == '#') continue;

		if(strtoupper(substr($sql, 0, 12)) == 'CREATE TABLE') {
			$db->query(createtable($sql, UC_DBCHARSET));
		} elseif (strtoupper(substr($sql, 0, 11)) == 'ALTER TABLE') {
			runquery_altertable($sql);
		} else {
			$db->query($sql);
		}
	}
}
开发者ID:healthguo,项目名称:PHP,代码行数:18,代码来源:upgrade_1.0.0Beta_1.0.0.php

示例15: microtime

$user = $response->getGraphUser();
*/
//echo 'Name: ' . $user['name'];
$time_pre = microtime(true);
//$request = $fb->get('/'.$requestedpageid.'?posts&limit=99','1615429865383287|nJkkwVhBA9Yf_uUXhw18GYYgSJU');
//$response = $request->execute();
//$graphObject = $request->getGraphObject();
//$graphArray=object_to_array( $graphObject);
//$meta=$graphObject->items['posts']->metaData['paging']['next'];
//print_r($graphArray);
$pageid = $requestedpageid;
//var_dump($graphObject);exit;
//echo '<table border=1>';
echo '<h1><a href="report.php?id=' . $pageid . '"> Click for reports</a></h1>';
if (!istable($pageid)) {
    createtable($pageid);
} else {
    die("local data loaded");
}
/*foreach($graphArray['posts'] as $post)
  {$date_formal = new DateTime($post['created_time']['date']);
  if(!isset($post['message'])){ $post['message']=''; $inclination=2;} else 
  $inclination=findsenti($post['message']);
  $qr="INSERT INTO `$pageid` (`post_id`,`text`,`time`,`report`) VALUES (\"".$post['id']."\",\"".$post['message']."\",\"".$date_formal->gettimestamp()."\",$inclination)";
  //echo $qr=mysqli_real_escape_string($mysqli,$qr);
  //echo'<br>';
  //exit;
  mysqli_query($mysqli,$qr);
	//echo '<tr><td>'.$post['id'].'</td><td>'.$post['message'].'</td><td>'.$inclination.'</td><td>'.$date_formal->gettimestamp().'</td></tr>';
  }
    //echo '</table>';
开发者ID:KunalT6569,项目名称:opinion-mining,代码行数:31,代码来源:test2.php


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