$db=mysql_connect("localhost","root","");
$sqlname="MESSAGE";
mysql_select_db($sqlname,$db);
mysql_query("SET NAMES 'gbk'",$db);
if($_POST['tj']){
$username=$_POST['username'];
$password=$_POST['password'];
$conpassword=$_POST['conpassword'];
if($password==$conpassword){
$pwd=$password;
}
else{
echo "";
}
$sql="insert into MESSAGE(user,password) values('".$username."','".$pwd."')";
$result=mysql_query($sql);
if($result)
{
echo "";
}
else
{
echo "";
}
}
?>
if(isset($_POST['button']))
{
//注册验证 然后插入数据库
}
?>
$con = mysql_connect($host, $dbuser,$dbpwd);
mysql_select_db($table);
//$user 入库前最好过滤一下
$sql = "insert into $table (user, password) values('".$user."','".$password."')";
if(@mysql_query($sql)){
echo "插入成功";
}