This is the function in php that I use to insert data in my users table
<?php
include 'includes/conexion.php';
$usuario = $_POST["usuario"];
$contraseña = $_POST["contraseña"];
$consulta = "INSERT INTO usuarios (id_usuario, nombre_usuario, contraseña_usuario) VALUES ('','$usuario','$contraseña')";
if($conexion->query($consulta)){
header("location: registar.php?created");
}else{
echo "Error al ingresar datos del post ".$consulta.$conexion->error;
exit();
}
? >
And what I get is this
Connect to the Error database when entering data from the post INSERT INTO users (user_id, user_name, user_password) VALUES ('', 'abisur', 'aiShinozaki23') 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 ' a_user) VALUES ('', 'abisur', 'aiShinozaki23') 'at line 1
You can explain to me why this happens, since you already check the fields and they are correct