<?php
$name=$_POST['name'];
$gender = $_POST['gender'];
$age=$_POST['age'];
#连接到数据库
$link = mysql_connect('localhost','root','0624');
if(!$link){
die('对不起,服务器繁忙');
}
#设置字符集,选择数据库
mysql_select_db('php2017');
$query = "insert into people values (null,'$name','$gender','$age')";
$add = mysql_query($query); if($add){
echo '添加成功';
}
else{
echo "添加失败";
}