本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
示例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' : '';
示例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方法直接执行
}
}
}
}
示例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);
}
}
}
示例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>';