table does't exists error . Why ??

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

table does't exists error . Why ??

Post by gautamz07 »

I have the table `tags`in my database 'peckinga_blog' , Now this works perfectly fine in my local environment , but when i upload to the server i get the following error:

Code: Select all

QueryException in Connection.php line 729:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'peckinga_blog.Tags' doesn't exist (SQL: select * from `Tags`)

Why am i getting this error and how can i overcome this ?
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: table does't exists error . Why ??

Post by gautamz07 »

I saw this answer here ,
http://stackoverflow.com/a/20795986/4381665

but how do i solve the problem
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: table does't exists error . Why ??

Post by requinix »

Either
a) You didn't create the table on that server. Fix the problem by creating the table.
b) You created it with a different name (perhaps lowercase "tags"). Fix the problem by changing your query to use the right table name.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: table does't exists error . Why ??

Post by gautamz07 »

Its the 2nd one , i have the table tags and on the server it seems to be looking for Tags . I am using laravel . is there someway i can make it look for tags without changeing the database .
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: table does't exists error . Why ??

Post by requinix »

Somewhere there is code telling it to look for that table. Find it and change it. I don't know your codebase any better than you.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: table does't exists error . Why ??

Post by gautamz07 »

ok thanks requinix.
User avatar
Celauran
Moderator
Posts: 6425
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: table does't exists error . Why ??

Post by Celauran »

Are you doing this through migrations? Have you run the migrations on the server as well as on local? A Tag Eloquent model should map to tags table unless you have specifically overridden it.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: table does't exists error . Why ??

Post by gautamz07 »

Hey celauran !

No i run the migrations only locally and exported the database to my server via phpmyadmin.

check the 3rd answer here -> http://stackoverflow.com/questions/2079 ... 6#20795986

could that be the problem ?
User avatar
Celauran
Moderator
Posts: 6425
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: table does't exists error . Why ??

Post by Celauran »

Don't know. Have you tried?

Have you set up the .env file on your production server? Are you connecting to the database? Is it just this table? Are other tables working? Code?
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: table does't exists error . Why ??

Post by gautamz07 »

@celauran , yes i have setup the .env file for my production server and just for testing puposes i turned the the following to true:

Code: Select all

APP_DEBUG=true
its says it cannot find the table , i have two tables tags and admin , in both cases its looking for Tags and Admin .. thats the problem . is that conclusive enough ?
User avatar
Celauran
Moderator
Posts: 6425
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: table does't exists error . Why ??

Post by Celauran »

And you've checked that the tables actually exist? I'd listen to the error message.
Post Reply