PHP表单提交数据库
<?php$name=$_POST['name'];$phone=$_POST['phone'];$key=$_POST['key'];$email=$_POST['em...
<?php
$name=$_POST['name'];
$phone=$_POST['phone'];
$key=$_POST['key'];
$email=$_POST['email'];
$select=$_POST['select'];
$content=$_POST['content'];
$addtime=data("Y-m-d h:i:s");
$mysql_server_name='localhost';
$mysql_username='root';
$mysql_password='';
$mysql_database='';
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_database);
$query="insert into user(name,key,phone,email,select,content,time) values('$name','$phone','$key','$email','$select','$content','$addtime')";
mysql_select_db($mysql_database,$conn);
mysql_query($query);
mysql_close($conn);
echo"正在跳转付款页面";
?>
代码哪错了 。求解
1楼求深解 展开
$name=$_POST['name'];
$phone=$_POST['phone'];
$key=$_POST['key'];
$email=$_POST['email'];
$select=$_POST['select'];
$content=$_POST['content'];
$addtime=data("Y-m-d h:i:s");
$mysql_server_name='localhost';
$mysql_username='root';
$mysql_password='';
$mysql_database='';
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_database);
$query="insert into user(name,key,phone,email,select,content,time) values('$name','$phone','$key','$email','$select','$content','$addtime')";
mysql_select_db($mysql_database,$conn);
mysql_query($query);
mysql_close($conn);
echo"正在跳转付款页面";
?>
代码哪错了 。求解
1楼求深解 展开
3个回答
展开全部
$query="insert into user(name,key,phone,email,select,content,time) values('$name','$phone','$key','$email','$select','$content','$addtime')";
$query="insert into user(name,key,phone,email,select,content,time) values('$name','$key','$phone','$email','$select','$content','$addtime')";
-------------
数据库字段的类型不同
$query="insert into user(name,key,phone,email,select,content,time) values('$name','$key','$phone','$email','$select','$content','$addtime')";
-------------
数据库字段的类型不同
展开全部
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_database);
改成
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
改成
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如非楼上所说,请检查你的数据库名,貌似你配置的是为空的,程序不知道要操作哪个数据库
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询