出于学习目的,我正在创建一个代码,可以连接到数据库,但不能插入到表中。 我是MySQL的新手,可以轻松地开始学习。
//DB INFO--
$servername = "localhost";
$username = "MeandMe";
$Password = "";
$dbName = "Db_test";
$userpassword = $_POST["pass"];
$useremail = $_POST["email"];
// I echoed these and yes my form gets sent and they have information.
$conn = new mysqli($servername , $username , $Password , $dbName);
// connecs fine :) yay...
if(!$conn){
die("Connection failed");
}
echo("Connection Sucsess");
$SQL = "INSERT INTO users (email, password)
VALUES('".$useremail."', '".$userpassword."')";
$result = mysqli_query($conn ,$SQL);
if(!$result ) echo("Error..."); // Get back Error.
else echo ("Register Sucsess");
?>