I have a table called user in postgresql. Now when I want to create a record in this table I am getting an exception:
AbstractPostgreSQLDriver->convertException('An exception occurred while executing \'INSERT INTO user (user_id, organization_id, client_id, username, password, type, lname, fname, init, email, date, time, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\' with params [6, 1, 1, "kmr", "kmr12345", "Individual", "c", "a", "b", "abc@gmail.com", "2017-07-30", "16:07:46", "active"]:SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "user"LINE 1: INSERT INTO user (user_id, organization_id, client_id, usern... ^', object(PDOException))
My table schema is :
user_id integer
organization_id integer
client_id integer
username character varying(255)
password character varying(255)
type character varying(255)
lname character varying(255)
fname character varying(255)
init character varying(255)
email character varying(255)
date character varying(255)
time character varying(255)
status character varying(255)
My symfony's parameters.yml is like;
parameters:
database_host: localhost
database_port: 5432
database_name: task_management
database_user: postgres
database_password: 123456
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
secret: ThisTokenIsNotSoSecretChangeIt
When I am using MySql db (definitely with a different configuration), same PHP code is working.
$user = new User();
$user->setUserId(1);
$user->setOrganizationId(1);
$user->setClientId(1);
$user->setUserName('k');
$user->setType('Individual');
$user->setPassword('kmr12345');
$user->setFirstName('a');
$user->setLastName('b');
$user->setInitial('c');
$user->setEmail('abc@gmail.com');
$user->setDate(date('Y-m-d'));
$user->setTime(date('H:m:s'));
$user->setStatus('active');
$em->persist($user);
$em->flush();
return $user->getUserId();
But in case of postgresql I am constantly getting this error.
Any help will be great for me.