I have the following code in my controllers, the insert query is not happening. I'm using postgresql for database.
$connection = Yii::app()->db2 ;
$command1 = "INSERT INTO USERS (username, user_type) VALUES (:username,:user_type)";
$cmd1 = $connection->createCommand($command1);
$cmd1->bindParam(":username",$username,PDO::PARAM_STR);
$cmd1->bindParam(":user_type",'USER',PDO::PARAM_STR);
$cmd1->execute();
echo "Completed...";
What's wrong in the code. the echo "Completed..."; is not printing. I have enabled my postgressql logs the insert query is not executed. No errors display in browser, only blank page is displaying.
the below formate is working to insert into my table. and the query is logged into postgresql log.
$command->insert('users', array(
'username'=>$username,
'user_type'=>'USER',
));
Thanks in Advance.