Figure : img1.当点击超链接“创建表”的时候去到一个新表单页面,createtable.html
Figure : img2.提交表名到一个处理数据php页面:createtable.php<?php
//1.接收表单的数据
$tableName = $_GET[‘tablename’];
//2.链接数据库
$link = @mysql_connect(‘localhost’,’root’,’’);
//2.选择数据库
mysql_select_db(‘php07’);
//3.设置编码
mysql_query(‘set names utf8’);
//4.准备SQL语句
$sql = <<<EEE
create table {$tableName} (
id smallint not null auto_increment primary key,
name varchar(20) not null comment ‘姓名’,
age tinyint not null comment ‘年龄’,
sex varchar(5) not null comment ‘性别’
) charset=utf8;
EEE;
//5.发送SQL语句
$res = mysql_query($sql);
if($res){
echo ‘创建成功’;
}else{
echo ‘创建失败’;
}
?>1.在需要显示数据页面获取数据并显示到相应的位置:table.phpFigure : img
Figure : img1.通过超链接传递当前要删除的表名:table.php
Figure : img2.接收表名并进行处理 droptable.php
Figure : img1.通过超链接传递表名到修改表单页面:table.php
Figure : img2.实现修改表的表单页面:altertable.php
Figure : img3.把修改后的数据传递到一个数据处理页面:alter-table.php
Figure : img