CDbException

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 MariaDB server version for the right syntax to use near 'ORDER BY -profile_group_users_view.order_id DESC, surname ASC, forenames ASC' at line 1. The SQL statement executed was: select profile_group_users_view.order_id, profile_group_users_view.POS_REF, staff_profile_display3.staff_id, forenames, surname, email, title, telephone, telephone, website, twitter, google_scholar, room_number, building_en, building_cy, web_contact_email,web_contact_telephone from staff_profile_display3 join profile_group_users_view on staff_profile_display3.staff_id=profile_group_users_view.staff_id where staff_profile_display3.staff_id IN ('') AND profile_group_users_view.group_id= ORDER BY -profile_group_users_view.order_id DESC, surname ASC, forenames ASC;

/webfs/php-packages/older-yii/vendor/yiisoft/yii/framework/db/CDbCommand.php(543)

531         {
532             if($this->_connection->enableProfiling)
533                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534 
535             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536             $message=$e->getMessage();
537             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
539 
540             if(YII_DEBUG)
541                 $message.='. The SQL statement executed was: '.$this->getText().$par;
542 
543             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545         }
546     }
547 
548     /**
549      * Builds a SQL SELECT statement from the given query specification.
550      * @param array $query the query specification in name-value pairs. The following
551      * query options are supported: {@link select}, {@link distinct}, {@link from},
552      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553      * {@link limit}, {@link offset} and {@link union}.
554      * @throws CDbException if "from" key is not present in given query parameter
555      * @return string the SQL statement

Stack Trace

#1
+
 /webfs/www/webapps/staff-profiles/protected/models/StaffProfile.php(542): CDbCommand->queryAll(5)
537             //$sql="Select profile_group_users_view.order_id, profile_group_users_view.POS_REF, spd.staff_id, spd.forenames, spd.surname, spd.email, spd.title, spd.telephone, spd.telephone, spd.website, spd.twitter, spd.room_number, spd.building_en, spd.building_cy, spd.web_contact_email,spd.web_contact_telephone FROM staff_profile_display".VERSION." AS spd  join profile_group_users_view on spd.staff_id=profile_group_users_view.staff_id where spd.staff_id IN (".$criteria.") ORDER BY -order_id DESC;";
538             $sql="select profile_group_users_view.order_id, profile_group_users_view.POS_REF, staff_profile_display3.staff_id, forenames, surname, email, title, telephone, telephone, website, twitter, google_scholar, room_number, building_en, building_cy, web_contact_email,web_contact_telephone  from staff_profile_display3 join profile_group_users_view on staff_profile_display3.staff_id=profile_group_users_view.staff_id where staff_profile_display3.staff_id IN (".$criteria.") AND profile_group_users_view.group_id=".$group_code." ORDER BY -profile_group_users_view.order_id DESC, surname ASC, forenames ASC;";
539             $staff_details=array();
540             $sorted=array();
541             $command  =  Yii::app()->db->createCommand( $sql );
542             foreach( $command->queryAll( PDO::FETCH_OBJ) as $row ){
543                 if((array_key_exists($row["staff_id"],$contracts)) AND (array_key_exists($row["POS_REF"], $contracts[$row["staff_id"]]))){
544                     $row['is_telephone']=substr($contracts[$row["staff_id"]][$row["POS_REF"]]['is_telephone'], -4);
545                     $row['job_title']=$contracts[$row["staff_id"]][$row["POS_REF"]]['job_title'];
546                 }
547                 if( isset($row["is_telephone"]) AND !isset($row["telephone"])){
#2
+
 /webfs/www/webapps/staff-profiles/protected/controllers/ListingController.php(152): StaffProfile->getGroupList("''", null, null, null, ...)
147             $real_group_name=$group_info[$localised_name];
148             $group_users=$this->findAPEXGroupUsers($group_id);
149             $criteria="'".implode("' , '", $group_users)."'";
150             $linktype=null;
151             $staffprofile = StaffProfile::model();
152             $staffprofile->getGroupList($criteria, $group_id, null, null, $this->staff_list_photo_enabled($dept_code));
153             $staffprofile->link=$linktype;
154             $staffprofile->render();
155             $staffprofile->renderer->group_info=array("group_name"=>$real_group_name, "group_desc"=>$group_info['group_desc'], "group_id"=>$group_id);
156             $staffprofile->renderer->is_group=true;
157 
#17
+
 /webfs/www/webapps/staff-profiles/index.php(90): CApplication->run()
85 }
86 else{
87     error_reporting(0);
88 }
89 require_once($yii);
90 Yii::createWebApplication($config)->run();
91 
92 function is_internal(){
93     $internal = null;
94     $revdns = gethostbyaddr($_SERVER['REMOTE_ADDR']);
95     if (($revdns !== $_SERVER['REMOTE_ADDR']) && preg_match('/\.aber\.ac\.uk$/', $revdns)){
2022-06-25 08:51:43 Apache/2.4.25 (Debian) Yii Framework/1.1.22