Home > Backend Development > PHP Tutorial > !php mysql注册有关问题 信息传不到数据库

!php mysql注册有关问题 信息传不到数据库

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:17:28
Original
1259 people have browsed it

求助!php mysql注册问题 信息传不到数据库
注册界面test.html



username: 
password 




test.php
$con=mysql_connect("localhost","root","admin");
mysql_query("set names utf8");
mysql_select_db("ms_user",$con)
mysql_query("INSERT INTO user(username,password)values('admin','admin')");
mysql_close($con);
?>

注册reg.php
$con = mysql_connect("localhost","root","admin");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("ms_user", $con);

$sql='INSERT INTO user (username, password) VALUES (.$_POST["username"].,.$_POST["password"].)';

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con)
?>

数据库ms_user 表名user 字段username password

就是注册不上 求助!!!!新手菜鸟!勿笑= =
------解决思路----------------------
$sql='INSERT INTO user (username, password) VALUES (.$_POST["username"].,.$_POST["password"].)';
Copy after login

是不是语句写错了。
$psw = $_POST['password'];<br />$username = $_POST['username'];<br />$sql="INSERT INTO user (username, password) VALUES ('$_POST["username"]','$_POST["password"]')";
Copy after login

------解决思路----------------------
你的页面中显示的是什么?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template