我的网站目前接受电子邮件注册(不登录)。在localhost上我设法将它链接到phpmyadmin。如何创建数据库以接受我网站上的注册。
<?php
session_start();
//connect to database
$db=mysqli_connect("IP address","user","passwd","dbname",port);
if (isset($_POST['register_btn'])) {
session_start();
$username= mysql_real_escape_string($_POST['username']);
$email= mysql_real_escape_string($_POST['email']);
$sql="INSERT INTO users(username,email) VALUES ('$username','$email')";
mysqli_query($db,$sql);
$_SESSION['username']=$username;
header("location:index.html");
}
else{
$_SESSION['message']="Error";
}
?>