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 '' at line 1. The SQL statement executed was: SELECT device_token,id,state_id,district_id,tehsil_id,village_id,name,slugs,user_type,phone,expert_badge_en,expert_badge_hn,expert_badge_pb FROM `tbl_users` WHERE `id`=

/var/www/vhosts/apnikheti.com/httpdocs/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
+
 /var/www/vhosts/apnikheti.com/httpdocs/protected/components/commionFunction.php(1351): CDbCommand->queryRow()
1346 
1347     public function getExpertDetails($user_id)
1348     {
1349         $sql = "SELECT device_token,id,state_id,district_id,tehsil_id,village_id,name,slugs,user_type,phone,expert_badge_en,expert_badge_hn,expert_badge_pb FROM `tbl_users` WHERE `id`=".$user_id;
1350         $rawData = Yii::app()->db2->createCommand($sql);
1351         return $categoryData = $rawData->queryRow();
1352     }
1353     
1354     public function getPostByAnswerQuestion($question_id)
1355     {
1356          $sql = "SELECT DISTINCT udt.user_id,udt.device_token,u.name,u.expert_badge_en,u.expert_badge_hn,u.expert_badge_pb,udt.device_type FROM tbl_experts_question AS eq,tbl_users AS u,tbl_user_devce_token AS udt WHERE udt.user_id=u.id AND u.id=eq.user_id AND eq.id='".$question_id."' group by udt.device_token";
#2
+
 /var/www/vhosts/apnikheti.com/httpdocs/protected/views/site/expertQADetailsDemo.php(54): MyClass->getExpertDetails(null)
49 {
50 $userDetailsQus = $myClass->getExpertDetails($question['user_id']);    
51 }
52 else
53 {
54 $userDetailsQus = $myClass->getExpertDetails($user_id);    
55 }
56 $resImgData = 0;
57 $langu = Yii::app()->language;
58 $language = New Languages($langu);
59 $langArray = array();
#7
+
 /var/www/vhosts/apnikheti.com/httpdocs/protected/controllers/SiteController.php(7655): CController->render("expertQADetailsDemo", array("model" => ExpertAnswer))
7650                     }
7651                  }
7652             }
7653             
7654             
7655             $this->render('expertQADetailsDemo', array('model' => $model));
7656         }
7657         else
7658         {     $model=new ExpertAnswer;
7659              $this->redirect(array('site/ExpertQA'));
7660         }
2024-03-29 15:34:11 Apache Yii Framework/1.1.19