hi i have this error in my page. try to write to SQL.
Error: INSERT INTO test123(username,password,group)VALUES('', '' , '') You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'group)VALUES('', '' , '')' at line 1
this is my code.
<html>
<div style="margin:10px auto; width:500px;">
<form method="post" action="">
<label>Name</label><br>
<input type="text" name="username"><br>
<label>Password</label><br>
<input type="text" name="password"><br>
<label>Group</label><br>
<input type="text" name="group"><br>
<input type="submit" name="submit">
</form>
</div>
</html>
<?php
$servername = "localhost";
$username = "root";
$password = "pass";
$dbname = "local";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$Name = $_POST['username'];
$Password = $_POST['password'];
$Group = $_POST['group'];
$sql = "INSERT INTO test123(username,password,group)VALUES('$Name', '$Password' , '$Group')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>