CDbException

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 ',20051,20053)' at line 1. The SQL statement executed was: select id,sex,username,nickname from tu_member where 1=1 and id in(,,20051,20053)

/data/travel_from_112_124_34_134/travel/framework/db/CDbCommand.php(528)

516             return $result;
517         }
518         catch(Exception $e)
519         {
520             if($this->_connection->enableProfiling)
521                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523             $message = $e->getMessage();
524             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526             if(YII_DEBUG)
527                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530         }
531     }
532 
533     /**
534      * Builds a SQL SELECT statement from the given query specification.
535      * @param array $query the query specification in name-value pairs. The following
536      * query options are supported: {@link select}, {@link distinct}, {@link from},
537      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538      * {@link limit}, {@link offset} and {@link union}.
539      * @return string the SQL statement
540      * @since 1.1.6

Stack Trace

#1
+
 /data/travel_from_112_124_34_134/travel/front/protected/modules/user/models/Member.php(106): CDbCommand->queryAll()
101         $sql = 'select ' .$field.' from ' . self::tableName().' where 1=1';
102         if(!empty ($where)) {
103             $sql .=" and ".$where;
104         }
105         $command = Yii::app()->dbu->createCommand($sql);
106         $rows = $command->queryAll();
107         return $rows;
108     }
109 
110     /**
111     *  通过用户名或邮箱获取用户id
#2
+
 /data/travel_from_112_124_34_134/travel/front/protected/modules/show/models/activities/Activities_detail.php(243): Member->getRows("id,sex,username,nickname", "id in(,,20051,20053)")
238             foreach($rows as $a_row){
239                 array_push($a_user_id,$a_row['user_id']);
240             }
241             $s_user_id = implode(',', $a_user_id);
242             $joiner_info = $rows;
243             $user_info = Member::model()->getRows('id,sex,username,nickname',"id in($s_user_id)");
244             for($i=0,$maxi=count($joiner_info); $i<$maxi; $i++){
245                 for($j=0,$maxj=count($user_info); $j<$maxj; $j++){
246                     if($joiner_info[$i]['user_id'] == $user_info[$j]['id']){
247                         if($user_info[$j]['nickname'] != '' && $user_info[$j]['nickname'] != null){
248                             $joiner_info[$i]['nickname'] = $user_info[$j]['nickname'];
#3
+
 /data/travel_from_112_124_34_134/travel/front/protected/modules/show/models/activities/Activities_detail.php(56): Activities_detail->getOneActivitiesJoinWork("25", "0")
51         
52         //得到参加者id
53         $a_activities_basic_info['joiner_info'] = $this->getOneActivitiesJoinerInfo($i_activities_id, 50);
54         
55         //得到参加作品
56         $a_activities_basic_info['join_work'] = $this->getOneActivitiesJoinWork($i_activities_id, $a_activities_basic_info['activities_join_type']);
57         
58         //得到登录者参加作品
59         $a_activities_basic_info['loginer_work_count'] = $this->getOneActivitiesLoginerWork($i_activities_id, $a_activities_basic_info['activities_join_type']);
60         
61         //得到登录者是否已经报名
2024-03-29 08:50:07 nginx/1.0.4 Yii Framework/1.1.10