I’m having a problem with bindvalue and Oracle. I use the same code as for mysql and it returns a value of 1. But when I use Oracle it returns a value of 0. I’m not getting any error messages.
Here is the code. This is in Chapter 8 of Agile Web Application Development with Yii1.1 and PHP5
[indent][/indent]public function isUserInProject($user)
I’m converting the Trackstar Application to Oracle and in Chapter 8 I’m having a problem with bindvalues. I’ve stepped through Trackstar in mysql and it will return 1 for true but in the Oracle version it returns 0 for false. The tables have the same information and the bind values look fine but it is not working.
Here is the code:
public function isUserInProject($user)
{
$sql = "SELECT USER_ID FROM TBL_PROJECT_USER_ASSIGNMENT WHERE PROJECT_ID = :projectId AND USER_ID = :userId";
//$sql = "SELECT USER_ID FROM TBL_PROJECT_USER_ASSIGNMENT WHERE PROJECT_ID = :projectId";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":projectId", $this->ID, PDO::PARAM_INT);
$command->bindValue(":userId", $user->ID, PDO::PARAM_INT);
return $command->execute()==1 ? true : false;
}
Maybe I should try a different approach to getting values from Oracle.
[color="#008000"]/* notice — the first 2 posts were originally posted in Yii 1.0.x Discussions, but have been moved to the proper forum and merged with the duplicated posts */[/color]
I’m glad I posted in version 1.0 because you are the only one that responded. I did check the mysql program and the original code does work, but doesn’t work for Oracle.
Thank you again. Very much appreciated. This has been quite a big learning curve for me and I appreciate all the help I have been given on this forum. I’m new to Frameworks, PHP, and object oriented programming but I’m really starting to like it.