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 C_Name from dmk_City where C_ID=8024.8109.

/home/daomenkou/framework/db/CDbCommand.php(544)

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

Stack Trace

#1
+
 /home/daomenkou/protected/controllers/MController.php(6249): CDbCommand->queryRow()
6244                 }
6245             } else {
6246                 for ($i = 2; $i < 5; $i++) {
6247                     if (!empty($city[$i])) {
6248                         $sql = "select C_Name from dmk_City where C_ID={$city[$i]}";
6249                         $U_ComAdd .= Yii::app()->db->createCommand($sql)->queryRow()['C_Name'];
6250                     }
6251                 }
6252             }
6253         }
6254         $U_ComAdd .= $UserComInfo['U_ComAdd'];
#10
+
 /home/daomenkou/index.php(57): CApplication->run()
52 header('Access-Control-Allow-Methods:*');
53 // 响应头设置
54 header('Access-Control-Allow-Headers:content-type,token,id,userId');
55 header("Access-Control-Request-Headers: Origin, X-Requested-With, content-Type, Accept, Authorization");
56 
57 Yii::createWebApplication($config)->run();
2024-03-28 18:26:44 Apache Yii Framework/1.1.15