Error while inserting name and password using a form to sql server using php. Can anyone help me?
$name = $_POST['add_name'];
$password =$_POST['add_pass'];
$query = "INSERT INTO zTest(user, password) VALUES ('".$name."','".$password."');";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt = sqlsrv_query($conn, $query, $params, $options );
if($stmt === false){
die ( print_r (sqlsrv_errors(), true));
}
Error Message:
Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 156 [code] => 156 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'user'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'user'. ) )