sql 我都是这样用的, 懒得用什么别的程序,太依赖那些不好,用记事本写个文本文件改名为 sql.php 例如- <?php
- include_once('common.php');
- $charset = str_replace('-', '', $_SC['charset']);
- $extend = $_SGLOBAL['db']->version() > '4.1' ? " DEFAULT CHARSET={$charset} " : "";
- $sql[] = "CREATE TABLE IF NOT EXISTS `uchome_job_collect` (
- `cid` int(10) unsigned NOT NULL auto_increment COMMENT '序列',
- `cuid` int(10) unsigned NOT NULL COMMENT 'UID',
- `collect` int(10) unsigned NOT NULL COMMENT '收藏',
- `apply` int(10) unsigned NOT NULL COMMENT '应聘',
- `corpid` int(10) unsigned NOT NULL COMMENT '公司',
- `jobid` int(10) unsigned NOT NULL COMMENT '工作',
- `applyinfo` mediumtext NOT NULL COMMENT '状态',
- `dateline` int(10) unsigned NOT NULL COMMENT '时间',
- PRIMARY KEY (`cid`)
- ) ENGINE=MyISAM {$extend};";
- $sql[] = "CREATE TABLE IF NOT EXISTS `uchome_job_company` (
- `id` int(10) unsigned NOT NULL auto_increment COMMENT '公司序列',
- `uid` int(10) unsigned NOT NULL COMMENT 'UID',
- `corptitle` varchar(200) NOT NULL COMMENT '公司名称',
- `industry` varchar(50) NOT NULL COMMENT '行业',
- `subindustry` varchar(50) NOT NULL COMMENT '行业',
- `corpprovince` varchar(50) NOT NULL COMMENT '公司地点省',
- `corpcity` varchar(50) NOT NULL COMMENT '公司地点市',
- KEY `uid` (`uid`)
- ) ENGINE=MyISAM {$extend};";
- foreach($sql as $val){
- $_SC['tablepre'] != 'uchome_' && $val = str_replace("`uchome_", '`'. $_SC['tablepre'], $val);
- if(!$_SGLOBAL['db']->query($val)){
- showmessage('数据库安装失败','',999);
- exit;
- }
- }
- showmessage('安装成功','',999);
复制代码 把 CREATE TABLE IF NOT EXISTS `uchome_ ... ) ENGINE 用你的sql代替, 有几个就替换几个(没有数量限制,格式要一致) ,放到uchome根目录下运行就行了
有些插件没有自动安装数据库的文件通常都是自己写个放在一起,方便发布也方便下次再用 |