CDbCommand failed to execute the SQL statement

CentOS Linux 5.3

Apache version 2.2.3

MySQL version 5.0.45

php 5.1.6

I received the following error when I uploaded my local project to server with the above configuration.

Internal Server Error

The table "Post" for active record class "Post" cannot be found in the database.

if I change the return value in tableName() to lower case, then it works

public function tableName()


{


	return &#039;<span style='color: red'>post</span>&#039;;


}

Then, when I tried to create a new post, I got the following error.

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

main.php config file

	&#039;db&#039;=&gt;array(


		&#039;class&#039;=&gt;&#039;CDbConnection&#039;,


		&#039;emulatePrepare&#039; =&gt; true,


		&#039;connectionString&#039;=&gt;&#039;mysql:host=localhost;dbname=dbname&#039;,


		&#039;username&#039;=&gt;&#039;dbuser&#039;,


		&#039;password&#039;=&gt;&#039;dbpass&#039;,


	),

What SQL is having this problem? You may turn on logging to see it.

here's the complete log

Description

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 'id #41, 'sdfsd', 'sdfsdf', 0)' at line 1

Source File

/home/websites/yii/framework/db/CDbCommand.php(211)

00199:                $n=$this->getConnection()->getPdoInstance()->exec($this->getText());

00200:

00201:            if($this->_connection->enableProfiling)

00202:                Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');

00203:

00204:            return $n;

00205:        }

00206:        catch(Exception $e)

00207:        {

00208:            if($this->_connection->enableProfiling)

00209:                Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');

00210:            Yii::log('Error in executing SQL: '.$this->getText().$params,CLogger::LEVEL_ERROR,'system.db.CDbCommand');

00211: throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',

00212:                array('{error}'=>$e->getMessage())));

00213:        }

00214:    }

00215:

00216:    /**

00217:      * Executes the SQL statement and returns query result.

00218:      * This method is for executing an SQL query that returns result set.

00219:      * @return CDbDataReader the reader object for fetching the query result

00220:      * @throws CException execution failed

00221:      */

00222:    public function query()

00223:    {

Stack Trace

#0 /home/websites/yii/framework/db/ar/CActiveRecord.php(1193): CDbCommand->execute()

#1 /home/websites/yii/framework/db/ar/CActiveRecord.php(992): CActiveRecord->insert(NULL)

#2 /home/websites/tube-18.com/protected/controllers/ShowController.php(71): CActiveRecord->save()

#3 /home/websites/yii/framework/web/actions/CInlineAction.php(32): ShowController->actionCreate()

#4 /home/websites/yii/framework/web/CController.php(300): CInlineAction->run()

#5 /home/websites/yii/framework/web/filters/CFilterChain.php(129): CController->runAction(Object(CInlineAction))

#6 /home/websites/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()

#7 /home/websites/yii/framework/web/CController.php(949): CFilter->filter(Object(CFilterChain))

#8 /home/websites/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))

#9 /home/websites/yii/framework/web/filters/CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain))

#10 /home/websites/yii/framework/web/CController.php(283): CFilterChain->run()

#11 /home/websites/yii/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)

#12 /home/websites/yii/framework/web/CWebApplication.php(332): CController->run('create')

#13 /home/websites/yii/framework/web/CWebApplication.php(120): CWebApplication->runController('show/create')

#14 /home/websites/yii/framework/base/CApplication.php(133): CWebApplication->processRequest()

#15 /home/websites/tube-18.com/index.php(11): CApplication->run()

I'd like to see the SQL, not callstack. Also, how do you try to create a post? What's the relevant code?