PHP 数据库都连接成功 但一直无法插入数据库
菜鸟求解<?php$name=$_POST["username"];$pass=$_POST["password"];$db=mysqli_connect("localh...
菜鸟求解
<?php
$name=$_POST["username"];
$pass=$_POST["password"];
$db=mysqli_connect("localhost:3306","root","");
if($db){
echo "数据库连接成功";
}else{
echo "失败";
};
$table=mysqli_select_db($db,"login");
if($table){
echo "连接成功";
}else{
echo "失败";
};
mysqli_query($db,"INSERT INTO tablename(username,userpass) VALUES('$name','$pass')");
?> 展开
<?php
$name=$_POST["username"];
$pass=$_POST["password"];
$db=mysqli_connect("localhost:3306","root","");
if($db){
echo "数据库连接成功";
}else{
echo "失败";
};
$table=mysqli_select_db($db,"login");
if($table){
echo "连接成功";
}else{
echo "失败";
};
mysqli_query($db,"INSERT INTO tablename(username,userpass) VALUES('$name','$pass')");
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询