Yii Framework Forum: Model Generator fails on creating table tbl_user - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Model Generator fails on creating table tbl_user Rate Topic: -----

#1 User is offline   lup0z 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 02-May 11

Posted 04 May 2011 - 03:29 AM

Hi!
I've installed Yii and decided to use mySQL with XAMPP.
Following the online guide, I go to the "Model Generator" with Gii and enter
- tbl_user for Table name
- User for Model Class

but when I go to press "preview" I got this error: "Table 'tbl_user' does not exist.".

What can I do?

Thaaanks!
0

#2 User is offline   adsmail27 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 29
  • Joined: 30-April 11

Posted 05 May 2011 - 07:37 PM

verify your config
0

#3 User is offline   dchan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 28-March 11
  • Location:Italy

Posted 08 May 2011 - 08:06 AM

Check your config.
Your config file is (should be) yourApp/protected/config/main.php.

You'll find 'db' section in this file as follows:
'db'=>array(
 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),

// uncomment the following to use a MySQL database
/*
'db'=>array(
 'connectionString' => 'mysql:host=localhost;dbname=testdrive',
 'emulatePrepare' => true,
 'username' => 'root',
 'password' => '',
 'charset' => 'utf8',
),
*/


If you use mysql database comment (or delete) the first example and uncomment the second, specifying the correct parameters. For example:
/*
'db'=>array(
 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
*/

// uncomment the following to use a MySQL database

'db'=>array(
 'connectionString' => 'mysql:host=localhost;dbname=yourdb',
 'emulatePrepare' => true,
 'username' => 'yourdbusername',
 'password' => 'yourdbpassword',
 'charset' => 'utf8',
),


Try again to create your Model with gii after changing this configuration.
0

#4 User is offline   stexyn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-November 12

Posted 20 November 2012 - 11:27 AM

Hi all,
this is my first time with yii and I'm using Xampp on a mac, following the online tutorial.
I have the same error of first post.
The error go away if I manually create the table on database...my config file seems ok.
So what's wrong?
Is it necessry to create table by hand?

EDIT: Following the guide, entry index.php?r=user I get the error
Error 404
Unable to resolve the request "user".
:-[


Thank you for help
0

#5 User is offline   stexyn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-November 12

Posted 26 November 2012 - 07:57 AM

View Poststexyn, on 20 November 2012 - 11:27 AM, said:

Hi all,
this is my first time with yii and I'm using Xampp on a mac, following the online tutorial.
I have the same error of first post.
The error go away if I manually create the table on database...my config file seems ok.
So what's wrong?
Is it necessry to create table by hand?

EDIT: Following the guide, entry index.php?r=user I get the error
Error 404
Unable to resolve the request "user".
:-[


Thank you for help


Nobody can help?
I don't understand if the procedure will create the tables automatically or I have to do it manually on database.

Thank you
0

#6 User is offline   Necrophorus 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 10-May 13

Posted 10 May 2013 - 05:11 AM

Hi!

I had the same issue here. Tried to create the table manually, and it seemed to be working but when I go to the user crud page no input form appears. I think gii SHOULD create the table automatically and donig it manually messes up something.

Anyway I find this online guide very disapponting. It skips a lot of details which are important for newbies in cteating their fitst app. There are lots of possible errors and glitches that should be explained further.
Now I'm stuck with this error, and having a very bad first impression of the whole yii frame work. :(
0

#7 User is offline   Ragu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 03-February 14

Posted 13 February 2014 - 01:17 AM

View Poststexyn, on 26 November 2012 - 07:57 AM, said:

Nobody can help?
I don't understand if the procedure will create the tables automatically or I have to do it manually on database.

Thank you



You have to create table on database manually. Then try to create model and all.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users