标签:people insert pos root roo 设置 int echo div
<?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 "添加失败"; }
标签:people insert pos root roo 设置 int echo div
原文地址:http://www.cnblogs.com/nasca/p/6260520.html