From config/main.php :
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=testdb',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),
When I use the gii model generator (http://localhost/yii/testdelete/index.php?r=gii/model) and try to put "post" or "user" in the table name and click "Preview" it says:
Table 'post' does not exist.
I want to be able to create models using those tables.
Exporting from phpMyAdmin:
-- Host: 127.0.0.1
-- Database: `testdb`
CREATE TABLE IF NOT EXISTS post
(
id
int(10) unsigned NOT NULL AUTO_INCREMENT,
created_on
int(11) unsigned NOT NULL,
title
varchar(255) COLLATE utf8_unicode_ci NOT NULL,
content
text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS user
(
id
int(10) unsigned NOT NULL AUTO_INCREMENT,
username
varchar(200) COLLATE utf8_unicode_ci NOT NULL,
password
char(40) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
If you type "s" into Table Name field auto complete should pop up with both tables.
check that