Hi, I have the following code:
$users=users::model()->findByPK(Yii::app()->user->getState("USER_ID")); $users->VIP_UNTIL = new CDbExpression('ADD_DATE(NOW(), INTERVAL 30 DAY)'); $users->save();
When trying to execute it, I get the following error:
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') WHERE `users`.`USER_ID`=13819550' at line 1 Source File D:AppServwwwYiiDevelopVersframeworkdbCDbCommand.php(192) 00180: try 00181: { 00182: if($this->_statement instanceof PDOStatement) 00183: { 00184: $this->_statement->execute(); 00185: return $this->_statement->rowCount(); 00186: } 00187: else 00188: return $this->getConnection()->getPdoInstance()->exec($this->getText()); 00189: } 00190: catch(Exception $e) 00191: { 00192: throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}', 00193: array('{error}'=>$e->getMessage()))); 00194: } 00195: } 00196: 00197: /** 00198: * Executes the SQL statement and returns query result. 00199: * This method is for executing an SQL query that returns result set. 00200: * @return CDbDataReader the reader object for fetching the query result 00201: * @throws CException execution failed 00202: */ 00203: public function query() 00204: {
What I see is that there is a ' after the PK number, which shouldn't be there. The aim of this post is to ask you whether this is a bug and so that you tell me whether to create a ticket or not.