CDbException

CDbCommand 无法执行 SQL 语句: 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 'LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `site_category` `t` WHERE id= LIMIT 1

/home/www/hlx_lccz/yii/framework/db/CDbCommand.php(516)

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

Stack Trace

#3
+
 /home/www/hlx_lccz/protected/controllers/InfoController.php(249): CActiveRecord->find(array("condition" => "id="))
244             $crumbsEnd = Category::model()->find(array(
245                 'condition'=>'id='.$id
246             ));
247             $crumbsParent = Category::model()->find(array(
248                 'condition'=>'id='.$crumbsEnd->parent
249             ));
250             $this->renderCompact('list',array(
251                 'parent' => $crumbsParent,
252                 'child' => $crumbsEnd,
253                 'naver' => $this->getNaver(),
254                 'id' => $id,
#11
+
 /home/www/hlx_lccz/index.php(18): CApplication->run()
13 //    $star_m = memory_get_usage();
14 //}
15 require_once($yii);
16 $app = Yii::createWebApplication($config);
17 $app->attachBehavior('WebBehavior', 'application.behavior.WebBehavior');
18 $app->run();
19 
20 //if (YII_DEBUG)
21 //{
22 //    echo ((memory_get_usage() - $star_m) / (1024*1024));
23 //}
2024-03-19 11:46:48 nginx/1.16.1 Yii Framework/1.1.8