table 'project' does not exist

Hi,

there are several postings for this issue but I didn’t find a solution yet.

I’m going through the bokk Yii1.1. and PHP5, created the database trackstar_dev (mysql 5), the table trs_project and then tried to create a model using gii. There I got this awefull error message.

Here’s my ‘db’ entry in config/main.php:




		'db'=>array(

			'connectionString' => 'mysql:host=localhost;dbname=trackstar_dev',

			'emulatePrepare' => true,

			'username' => 'user',

			'password' => 'password',

			'charset' => 'utf8',

			'tablePrefix' => 'trs_',

		),



gii shows the tablePrefix as ‘trs_’. Could it be that I may not define a table prefix on my own?

Yii Version is 1.1.8 r3324, PHP 5.3.5, Apache 2 on Windows 7 Pro x64. A connection to the databes can be established (tested with a unit test).

Thanks for any help

Christian

If you are using unit tests you are using the configuration in protected/config/console.php … ;)

Check that it matches the settings in protected/config/main.php.

Hi,

thanks for your reply - no, I didn’t use unit test in this case. After doing all necessary definitions as stated in my first posting in the browser I called “localhost/trackstar/index.php?r=gii” and got the gii formular where, after logging in, I selected “Model Generator”. After typing in “project” as the table name (without quotes!) I got the message “table project does not exist”.

Gii shows the right table prefix as "trs_".

The table trs_project has been created using "InnoDB", the database is trackstar_dev. Maybe this would lead to a solution?

Christian

Try to look in you model the name of table. Maybe is ‘project’ and you need ‘trs_project’.




class Prova extends CActiveRecord

{

	public function tableName()

	{

		return 'Prova';

	}

}



Yii should handle the prefix automatically.

Can’t remember how Gii handles it - it’s been a while since I used it - but try and insert the fully qualified table name: trs ̣̣projects

Note: for some reason my keyboard stopped supporting underscores… :)

Thanks for all replies.

Gii doesn’t handle the prefix automatically. One must type in the fully qualified table name, means with prefix.

Christian

Hi peeps I having the same problem here, I’m a newbie to Yii. I’m working on a windows 7 laptop in combination with version 2.2

Apache Version : 2.2.21

PHP Version : 5.3.8

pdo extension are installed

pdo_sqlite

pdo_mysql