0

0

创建数据库php代码 用PHP写出自己的BLOG系统_php实例

php中文网

php中文网

发布时间:2016-05-17 09:26:41

|

1385人浏览过

|

来源于php中文网

原创

下面直接上代码

MVM mall 网上购物系统
MVM mall 网上购物系统

采用 php+mysql 数据库方式运行的强大网上商店系统,执行效率高速度快,支持多语言,模板和代码分离,轻松创建属于自己的个性化用户界面 v3.5更新: 1).进一步静态化了活动商品. 2).提供了一些重要UFT-8转换文件 3).修复了除了网银在线支付其它支付显示错误的问题. 4).修改了LOGO广告管理,增加LOGO链接后主页LOGO路径错误的问题 5).修改了公告无法发布的问题,可能是打压

下载
复制代码 代码如下:

php
//date_default_timezone_set("Asia/Shanghai");
/*
function create_siteinfo
DONE:网站信息表
Author:www.5dkx.com
DATE:2010-3-30
表结构:
title 网站名
keyword 网站关键词
description 网站描述
*/
function create_siteinfo()
{
global $conn;
$sql = "create table siteinfo (
title varchar(100) not null,
keyword varchar(200) not null,
description varchar(200) not null
)";
$dropsql = "drop table if exists siteinfo";
mysql_query($dropsql,$conn)or die("删除表siteinfo失败!");
mysql_query($sql,$conn)or die("创建表siteinfo失败!");
}
/*
function:create_article()
DONE:mysql创建文章表sql语句
Author:www.5dkx.com
表结构:
id 文章ID
cid 归属类别ID
abstract 文章摘要
title 文章标题
posttime 发布时间
aurhor 作者
comefrom 文章来源
comeurl 来源URL
content 正文内容
keyword 关键词
rank 文章等级
views 浏览次数
*/
function create_article()
{
global $conn,$table_article;
$sql ="create table $table_article(
id int(11) auto_increment not null,
cid int(5) not null,
abstract varchar(300) not null,
title varchar(50) not null,
posttime datetime not null,
author varchar(30) not null,
comefrom varchar(50) not null,
comeurl varchar(50) not null,
content TEXT not null,
keyword varchar(20) not null,
rank int(2) not null,
views int(5) not null,
PRIMARY KEY(id)
)";
$dropsql = "drop table if exists $table_article";
mysql_query($dropsql,$conn)or die("删除数据库失败!");
mysql_query($sql,$conn)or die("创建数据库失败!");
}
/*
function:create_member()
DONE:mysql创建会员表sql语句
Author:www.5dkx.com
uid 会员ID
u_name 会员名称
u_passwd 密码
rank 会员等级
*/
function create_member()
{
global $conn,$table_member;
$sql = "create table $table_member(
uid int(5) auto_increment not null,
u_name varchar(20) not null UNIQUE,
u_passwd varchar(100) not null,
rank int(2) not null,
PRIMARY KEY(uid)
)";
$dropsql = "drop table if exists $table_member";
mysql_query($dropsql,$conn)or die("删除数据库失败!");
mysql_query($sql,$conn)or die("创建数据库失败!");
}
/*
function:create_class
DONE:sql创建分类sql语句
Author:www.5dkx.com
表结构:
cid 类类别ID
cname 类名
*/
function create_class()
{
global $conn,$table_class;
$sql = "create table $table_class(
cid int(5) auto_increment not null,
cname varchar(50) not null UNIQUE,
PRIMARY KEY(cid)
)";
$dropsql = "drop table if exists $table_class";
mysql_query($dropsql,$conn)or die("删除".$table_class."失败!");
mysql_query($sql,$conn)or die("创建表".$table_class."失败");
}
/*
function:create_guest
DONE:sql创建留言板sql语句
Author:www.5dkx.com
表结构:
gid 留言ID
g_name 留言用户名
g_site 用户个人主页
g_mail 用户邮箱
g_cid 留言位置(哪篇文章或者是留言板)
*/
function create_guest()
{
global $conn,$table_guest;
$sql = "create table $table_guest(
gid int(11) auto_increment not null,
g_name varchar(50) not null,
g_site varchar(50) not null,
g_mail varchar(50) not null,
g_cid int(5) not null,
PRIMARY KEY(gid)
)";
$dropsql = "drop table if exists $table_guest";
mysql_query($dropsql,$conn)or die("删除表".$table_guest."失败");
mysql_query($sql,$conn)or die("创建表".$table_guest."失败");
}
function create_sql()
{
global $table_article,$table_member,$table_class,$table_guest,$conn;
echo "创建siteinfo表 ……";
create_siteinfo();
echo "完成
";
echo "创建".$table_article."表 ……";
create_article();
echo "完成
";
echo "创建".$table_member."表 ……";
create_member();
echo "完成
";
echo "创建".$table_class."表 ……";
create_class();
echo "完成
";
echo "创建".$table_guest."表 ……";
create_guest();
echo "完成
";
mysql_close($conn);
}
?>

相关文章

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载

相关标签:

php

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
Word 字间距调整方法汇总
Word 字间距调整方法汇总

本专题整合了Word字间距调整方法,阅读下面的文章了解更详细操作。

2

2025.12.24

任务管理器教程
任务管理器教程

本专题整合了任务管理器相关教程,阅读下面的文章了解更多详细操作。

2

2025.12.24

AppleID格式
AppleID格式

本专题整合了AppleID相关内容,阅读专题下面的文章了解更多详细教程。

0

2025.12.24

csgo视频观看入口合集
csgo视频观看入口合集

本专题整合了csgo观看入口合集,阅读下面的文章了知道更多入口地址。

29

2025.12.24

yandex外贸入口合集
yandex外贸入口合集

本专题汇总了yandex外贸入口地址,阅读下面的文章了解更多内容。

58

2025.12.24

添加脚注通用方法
添加脚注通用方法

本专题整合了添加脚注方法合集,阅读专题下面的文章了解更多内容。

1

2025.12.24

重启电脑教程汇总
重启电脑教程汇总

本专题整合了重启电脑操作教程,阅读下面的文章了解更多详细教程。

3

2025.12.24

纸张尺寸汇总
纸张尺寸汇总

本专题整合了纸张尺寸相关内容,阅读专题下面的文章了解更多内容。

5

2025.12.24

Java Spring Boot 微服务实战
Java Spring Boot 微服务实战

本专题深入讲解 Java Spring Boot 在微服务架构中的应用,内容涵盖服务注册与发现、REST API开发、配置中心、负载均衡、熔断与限流、日志与监控。通过实际项目案例(如电商订单系统),帮助开发者掌握 从单体应用迁移到高可用微服务系统的完整流程与实战能力。

1

2025.12.24

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
PostgreSQL 教程
PostgreSQL 教程

共48课时 | 5.9万人学习

Django 教程
Django 教程

共28课时 | 2.4万人学习

MySQL 教程
MySQL 教程

共48课时 | 1.4万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号