SQL 错误消息: "Table 'xm_posts' is ed as crashed and should be repaired" SQL 语句: "SELECT `xm_posts`.* FROM `xm_posts` WHERE post_parent in (1703) and new_topic!=1 ORDER BY pid ASC" SQL 错误代码: "7335941".
错误原因:
您看到这个错误页面是因为应用程序抛出了没有捕获的异常。 
异常的详细内容: exception 'FLEA_Db_Exception_SqlQuery' with message 'SQL 错误消息: "Table 'xm_posts' is ed as crashed and should be repaired"
SQL 语句: "SELECT  `xm_posts`.* FROM `xm_posts`  WHERE post_parent in (1703) and new_topic!=1  ORDER BY pid ASC"
SQL 错误代码: "7335941".' in E:\ixingmei\lib\FLEA\FLEA\Db\Driver\Mysql.php:126
Stack trace:
#0 E:\ixingmei\lib\FLEA\FLEA\Db\TableDataGateway.php(448): FLEA_Db_Driver_Mysql->execute('SELECT  `xm_pos...')
#1 E:\ixingmei\DB\Post.php(38): FLEA_Db_TableDataGateway->findAll('post_parent in ...', 'pid ASC', NULL, '*')
#2 E:\ixingmei\DB\Post.php(115): DB_Post->loadGroupPostsList('post_parent in ...', '*', 'pid ASC')
#3 E:\ixingmei\Controller\Cinema.php(297): DB_Post->loadPostOfTopic('1707', 1)
#4 E:\ixingmei\lib\FLEA\FLEA\Dispatcher\Simple.php(120): Controller_Cinema->actionTopic()
#5 E:\ixingmei\lib\FLEA\FLEA\Dispatcher\Simple.php(77): FLEA_Dispatcher_Simple->_executeAction('cinema', 'topic', 'Controller_Cine...')
#6 E:\ixingmei\lib\FLEA\FLEA.php(810): FLEA_Dispatcher_Simple->dispatching()
#7 E:\ixingmei\index.php(98): FLEA::runMVC()
#8 {main}
Exception: FLEA_Db_Exception_SqlQuery
Message: SQL 错误消息: "Table 'xm_posts' is ed as crashed and should be repaired" SQL 语句: "SELECT `xm_posts`.* FROM `xm_posts` WHERE post_parent in (1703) and new_topic!=1 ORDER BY pid ASC" SQL 错误代码: "7335941".
--------------------------------------------------------------------------------
Filename: E:\ixingmei\lib\FLEA\FLEA\Db\TableDataGateway.php [448]
#8 FLEA_Db_Driver_Mysql::execute('SELECT `xm_posts`.* FROM ` ...') 
ARGS:
Array
(
    [0] => SELECT  `xm_posts`.* FROM `xm_posts`  WHERE post_parent in (1703) and new_topic!=1  ORDER BY pid ASC
)
SOURCE CODE: 
 438               // 当有关联需要处理时,必须获得主表的主键字段值
 
 439               $sql = "SELECT {$distinct} {$this->qpka}, {$fields} FROM {$this->qtableName} {$whereby} {$sortby}";
 
 440           } else {
 
 441               $sql = "SELECT {$distinct} {$fields} FROM {$this->qtableName} {$whereby} {$sortby}";
 
 442           }
 
 443   
 
 444           // 根据 $length 和 $offset 参数决定是否使用限定结果集的查询
 
 445           if (null !== $length || null !== $offset) {
 
 446               $result = $this->dbo->selectLimit($sql, $length, $offset);
 
 447           } else {
 
 448               $result = $this->dbo->execute($sql);
 
 449           }
 
 450   
 
 451           if ($enableLinks) {
 
 452               /**
 
 453                * 查询时同时将主键值单独提取出来,
 
 454                * 并且准备一个以主键值为键名的二维数组用于关联数据的装配
 
 455                */
 
 456               $pkvs = array();
 
 457               $assocRowset = null;
 
 458               $rowset = $this->dbo->getAllWithFieldRefs($result, $this->pka, $pkvs, $assocRowset);
 --------------------------------------------------------------------------------
Filename: E:\ixingmei\DB\Post.php [38]
#7 FLEA_Db_TableDataGateway::findAll('post_parent in (1703) and n ...', 'pid ASC', , '*') 
ARGS:
Array
(
    [0] => post_parent in (1703) and new_topic!=1
    [1] => pid ASC
    [2] => 
    [3] => *
)
SOURCE CODE: 
 28    }
 
 29   
 
 30    /**
 
 31     * 获取帖子列表
 
 32     *
 
 33     * @param unknown_type $where
 
 34     * @param unknown_type $fields
 
 35     */
 
 36    function loadGroupPostsList($where=null,$fields=null,$sort=null,$limit=null)
 
 37    {
 
 38    return $this->findAll($where,$sort,$limit,$fields);
 
 39    }
 
 40   
 
 41    /**
 
 42     * 更改主题内容
 
 43     *
 
 44     * @param unknown_type $pid
 
 45     * @param unknown_type $update_row_arr
 
 46     * @return unknown
 
 47     */
 
 48    function updateGroupPost($pid, $update_row_arr = null)
 --------------------------------------------------------------------------------
Filename: E:\ixingmei\DB\Post.php [115]
#6 DB_Post::loadGroupPostsList('post_parent in (1703) and n ...', '*', 'pid ASC') 
ARGS:
Array
(
    [0] => post_parent in (1703) and new_topic!=1
    [1] => *
    [2] => pid ASC
)
SOURCE CODE: 
 105    function loadPostOfTopic($topic_id,$limit)
 
 106    {
 
 107    $pt_posts_list = $this->loadGroupPostsList("topic_id=".$topic_id." and post_parent=0",'*',"pid ASC",$limit);
 
 108    if($pt_posts_list){
 
 109    $group_topic_db = &get_singleton('DB_Topic');
 
 110    $pt_posts_list = $group_topic_db->formateGroupTopicsList($pt_posts_list,100,array('user_info'=>true));
 
 111    foreach ($pt_posts_list as $pt_posts_info){
 
 112    $pt_pids[]=$pt_posts_info['pid'];
 
 113    }
 
 114    $pt_pids = implode(",",$pt_pids);
 
 115    $cd_posts_list = $this->loadGroupPostsList("post_parent in (".$pt_pids.") and new_topic!=1",'*',"pid ASC");
 
 116    if($cd_posts_list){
 
 117    $cd_posts_list = $group_topic_db->formateGroupTopicsList($cd_posts_list,100,array('user_info'=>true));
 
 118    }
 
 119    foreach ($pt_posts_list as $pt_posts_key => $pt_posts_info) {
 
 120   // $pt_posts_list[$pt_posts_key]['title']=$pt_posts_list[$pt_posts_key]['post_title'];unset($pt_posts_list[$pt_posts_key]['post_title']);
 
 121   // $pt_posts_list[$pt_posts_key]['starter_id']=$pt_posts_list[$pt_posts_key]['author_id'];unset($pt_posts_list[$pt_posts_key]['author_id']);
 
 122   // $pt_posts_list[$pt_posts_key]['start_date']=$pt_posts_list[$pt_posts_key]['post_date'];unset($pt_posts_list[$pt_posts_key]['post_date']);
 
 123    $pt_posts_list[$pt_posts_key]['edit_time_ext']=date('Y-m-d H:i:s',$pt_posts_list[$pt_posts_key]['edit_time']);
 
 124    $pt_posts_list[$pt_posts_key]['post_date_ext']=date('Y-m-d H:i:s',$pt_posts_list[$pt_posts_key]['post_date']);
 
 125   // if($pt_posts_list[$pt_posts_key]['edit_uid']){
 

解决方案 »

  1.   

    --------------------------------------------------------------------------------
    Filename: E:\ixingmei\Controller\Cinema.php [297]
    #5 DB_Post::loadPostOfTopic('1707', 1) 
    ARGS:
    Array
    (
        [0] => 1707
        [1] => 1
    )
    SOURCE CODE: 
     287     */
     
     288    function actionTopic(){
     
     289    if(!is_numeric($_GET['id'])){
     
     290    return false;
     
     291    }
     
     292    
     
     293    if($_GET['type']=='topic'){
     
     294    $topic_db = &get_singleton('DB_Topic');
     
     295    $topic_info = $topic_db->find("tid=".$_GET['id'],null,"*");
     
     296    $post_db = &get_singleton('DB_Post');
     
     297    $topic_post_info = $post_db->loadPostOfTopic($_GET['id'],1);
     
     298    $this->tpl->assign('TopicInfo',$topic_post_info[0]);
     
     299    }
     
     300    elseif($_GET['type']=='film'){
     
     301    $film_db = &FLEA::getSingleton('DB_Film');
     
     302    $film_info = $film_db->find("fid=".$_GET['id'],null,"*");
     
     303    if($film_info){
     
     304    $update_row=array(
     
     305    'hits_t'=>($film_info['hits_t']+1),
     
     306    );
     
     307    $film_db->updateByConditions("fid=".$_GET['id'],$update_row);
     --------------------------------------------------------------------------------
    Filename: E:\ixingmei\lib\FLEA\FLEA\Dispatcher\Simple.php [120]
    #4 Controller_Cinema::actionTopic() 
    ARGS:
    Array
    (
    )
    SOURCE CODE: 
     110               }
     
     111               if (method_exists($controller, '__setDispatcher')) {
     
     112                   $controller->__setDispatcher($this);
     
     113               }
     
     114   
     
     115               // 调用 _beforeExecute() 方法
     
     116               if (method_exists($controller, '_beforeExecute')) {
     
     117                   $controller->_beforeExecute($actionMethod);
     
     118               }
     
     119               // 执行 action 方法
     
     120               $ret = $controller->{$actionMethod}();
     
     121               // 调用 _afterExecute() 方法
     
     122               if (method_exists($controller, '_afterExecute')) {
     
     123                   $controller->_afterExecute($actionMethod);
     
     124               }
     
     125               return $ret;
     
     126           } while (false);
     
     127   
     
     128           if ($callback) {
     
     129               // 检查是否调用应用程序设置的错误处理程序
     
     130               $args = array($controllerName, $actionName, $controllerClass);
     --------------------------------------------------------------------------------
    Filename: E:\ixingmei\lib\FLEA\FLEA\Dispatcher\Simple.php [77]
    #3 FLEA_Dispatcher_Simple::_executeAction('cinema', 'topic', 'Controller_Cinema') 
    ARGS:
    Array
    (
        [0] => cinema
        [1] => topic
        [2] => Controller_Cinema
    )
    SOURCE CODE: 
     67   
     
     68       /**
     
     69        * 从请求中分析 Controller、Action 和 Package 名字,然后执行指定的 Action 方法
     
     70        *
     
     71        * @return mixed
     
     72        */
     
     73       function dispatching()
     
     74       {
     
     75           $controllerName = $this->getControllerName();
     
     76           $actionName = $this->getActionName();
     
     77           return $this->_executeAction($controllerName, $actionName, $this->getControllerClass($controllerName));
     
     78       }
     
     79   
     
     80       /**
     
     81        * 执行指定的 Action 方法
     
     82        *
     
     83        * @param string $controllerName
     
     84        * @param string $actionName
     
     85        * @param string $controllerClass
     
     86        *
     
     87        * @return mixed
     --------------------------------------------------------------------------------
    Filename: E:\ixingmei\lib\FLEA\FLEA.php [810]
    #2 FLEA_Dispatcher_Simple::dispatching() 
    ARGS:
    Array
    (
    )
    SOURCE CODE: 
     800               require_once($MVCPackageFilename);
     
     801           }
     
     802           FLEA::init();
     
     803   
     
     804           // 载入调度器并转发请求到控制器
     
     805           $dispatcherClass = FLEA::getAppInf('dispatcher');
     
     806           FLEA::loadClass($dispatcherClass);
     
     807   
     
     808           $dispatcher =& new $dispatcherClass($_GET);
     
     809           FLEA::register($dispatcher, $dispatcherClass);
     
     810           $dispatcher->dispatching();
     
     811       }
     
     812   
     
     813       /**
     
     814        * 准备运行环境
     
     815        *
     
     816        * @param boolean $loadMVC
     
     817        */
     
     818       function init($loadMVC = false)
     
     819       {
     
     820           static $firstTime = true;
     --------------------------------------------------------------------------------
    Filename: E:\ixingmei\index.php [98]
    #1 FLEA::runMVC() 
    ARGS:
    Array
    (
    )
    SOURCE CODE: 
      88   FLEA::init();
     
      89   
     
      90   FLEA::loadClass('XM_Pager');
     
      91   FLEA::loadClass("XM_Session");
     
      92   
     
      93   $xm_session = new xm_Session();
     
      94   FLEA::register($xm_session,'xmsession');
     
      95   
     
      96   FLEA::import(APP_DIR);
     
      97   
     
      98   FLEA::runMVC();
     
      99   
     
     100   // 显示执行花费的时间
     
     101   //$end = get_microtime();
     
     102   //printf("\n<!--Elapsed: %0.3fms-->\n", ($end - $begin) * 1000);
     
     103   ?> 
      

  2.   

    命令行执行mysql命令 myisamchk -r xm_posts
    或者在phpmyadmin中 相应的库执行 REPAIR TABLE xm_posts
      

  3.   

    http://hi.baidu.com/wowzm/blog/item/03f26609ff0365c93ac76374.html
      

  4.   

    表'xm_posts'被标记为坠毁,应该被修复
      

  5.   

     REPAIR TABLE xm_posts
    optimize table xm_posts
    用这两个试一下