Help in Getting Started using WAMP MySQL

I've set up the "testdrive" application using the Definitive Guide (yii-guide-1.0.0.pdf). I've encountered a problem when trying the CRUD command using the Yii Interactive Tool v1.0, (i.e. when using "crud User" command).

However, when using the "model User" command, I do not encounter any problem and the model was created successfully.

Error message:

Error: Table "User" does not have a primary key

Primary key was set on the said table:

CREATE TABLE user (

  id int(11) NOT NULL auto_increment,

  username varchar(128) NOT NULL,

  password varchar(128) NOT NULL,

  email varchar(128) NOT NULL,

  PRIMARY KEY  (id)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

I have tried both using either MyISAM,  InnoDB engine.

Any help would be GREATLY appreciated.

Thanks.


My development environment is as the following:

Wampserver 2.0

Apache Version : 2.2.8 

PHP Version : 5.2.6 

Loaded Extensions :

        * bcmath

        * calendar

        * com_dotnet

        * ctype

        * session

        * filter

        * ftp

        * hash

        * iconv

        * json

        * odbc

        * pcre

        * Reflection

        * date

        * libxml

        * standard

        * tokenizer

        * zlib

        * SimpleXML

        * dom

        * SPL

        * wddx

        * xml

        * xmlreader

        * xmlwriter

        * apache2handler

        * gd

        * mbstring

        * mysql

        * mysqli

        * PDO

        * pdo_mysql

        * soap

        * SQLite

MySQL Version : 5.0.51b 

Hello

I had the same behaviour. My problem was, that the php_pdo and php_pdo_sqlite extensions were not enabled for the command line version of php. It uses another php.ini file than the apache server.

See the red backgrounded boxes in the "Definitive Guide to Yii" in the Chaptre "Creating First Yii Application".

After changing the correct php.ini file (and restarting the shell) it worked.

@lupo,

Thank you very much for your suggestion. Problem solved after I restarted the shell. So, lesson learned: Restart yiic shell after enabling the php PDO extension on the Wampserver.

Thanks!  ;D

ah, that was helpfull. Rebooting the shell did the trick.

(I was only rebooting apache : )