says table doesn't exist when I use Gii to generate model

I have been using Yii with MAMP for the last week without problem. However, today, I set up a new project, created a database and tried to use Gii to create a new model but it’s giving me a message “table name doesn’t exist.”

I have confirmed many times that such a table exists in PHP MY Admin. I also did a reinstall on MAMP and have the same problem

Can anyone guess what the problem might be or know a way to find out

I have confirmed many times that I have a database named


test1

with table Employee (see pic below)

this is my config file database details




	'db'=>array(

			'connectionString' => 'mysql:host=localhost;port:8889;dbname=test1',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => 'root',

			'charset' => 'utf8',

		),

		

Note, I tried both “Employee” and “employee” in the Gii code generator, even though there’s only one screenshot below with “employee”. Also note that in the php my admin screen shot it says there are no tables in test1, but after I refreshed it, it lists the tables but I still have same problem

1685

Screen shot 2011-06-01 at 7.09.41 AM.png

I think there might be something wrong with your phpMyAdmin. At the left it should also list your tables (where it sais no tables). Try creating a database with tables using Chive or SequelPro

it was only that way because PHPmyadmin uses frames on the left side. Once I refreshed, it listed the tables on the left. However, the problem remains. I think I mentioned this at the bottom of the OP.

I just tried to recreate your situation couldn’t accomplish it. Only things I can see that are different in our cases are that I’m not specifying the ports in the connectionstring




'db'=>array(

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

			'emulatePrepare' => true,

			'username' => 'bandenspec',

			'password' => 'asdasd',

			'charset' => 'utf8',

		),



Another thing might be the rights for gii, I usually just do sudo chmod -r 777 my htdocs directory for localhost.

If you are setting a port, then you should set the host to 127.0.0.1(instead of ‘localhost’) ;)