<div class="d1">
<span><h1 align="center">注册会员</h1></span>
<form action="" method="post">
<table class="ta1">
<tr><td align="right">姓名:</td><td><input type="text" name="vip_name"></td></tr>
<tr><td align="right">联系电话:</td><td><input type="text" name="vip_tellphone"></td></tr>
<tr><td align="right">充值时间:</td><td><input type="text" name="vip_registertime"></td></tr>
<tr><td align="right">充值金额:</td><td><input type="text" name="vip_recharge"></td></tr>
<tr><td align="right">住址:</td><td><input type="text" name="vip_address"></td></tr>
</table>
<div class="span1"><input type="submit" name="add" value="注册">
<input type="reset" name="reset" value="重置"></div>
</form>
</div>
<?php
if(isset($_POST["add"]))
{
require_once "config.php";
$name=$_POST["vip_name"];
$tellphone=$_POST["vip_tellphone"];
$registertime=$_POST["vip_registertime"];
$recharge=$_POST["vip_recharge"];
$address=$_POST["vip_address"];
$sql="insert into info_vip(name,tellphone,registertime,recharge,address)
values('$name','$tellphone','$registertime','$recharge','$address')";
if(mysqli_query($connect,$sql))
echo "<script>alert('注册成功');this.location.href='select.php'</script>";
else
echo "<script>alert('注册失败');this.location.href='add.php'</script>";
mysqli_close($connect);
}
?>
另一个
<?php
@$connect=mysqli_connect("1.com","root","root");
if(!$connect)
die( "连接数据库服务器失败".mysqli_connect_error()."<br>");
mysqli_set_charset($connect,"utf8");
$sql_database="create database if not exists vip";
if(mysqli_query($connect,$sql_database))
echo "数据库创建成功";
else
echo "数据库创建失败";
$connect1=mysqli_select_db($connect,"vip");
if(!$connect1)
die("连接数据库失败".mysqli_error($connect)."<br>");
$sql_table="create table if not exists info_vip(id int not null auto_increment,
name varchar(20) not null,
tellphone varchar(11) not null,
registertime date not null,
recharge int(10) not null,
address varchar(50) not null,
operation varchar(25) not null,
primary key(id)
)";
if(mysqli_query($connect,$sql_table))
echo "数据表创建成功";
else
echo "数据表创建失败";
m
ysqli_close($connect);
?>