Spaces:
Running
Running
$servername = "localhost"; | |
$username = "root"; | |
$password = " "; | |
$dbname = "typroject"; | |
// Create connection | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed: " . $conn->connect_error); | |
} | |
// Get data from the form | |
$username = $_POST['username']; | |
$email = $_POST['email']; | |
$password = $_POST['password']; | |
// Insert data into the database | |
$sql = "INSERT INTO registration (username, password, email) VALUES ('$username','$email', '$password', )"; | |
if ($conn->query($sql) === TRUE) { | |
echo "Registration Successfully"; | |
} else { | |
echo "Error: " . $sql . "<br>" . $conn->error; | |
} | |
$conn->close(); | |