Page 1 of 1

table does't exists error . Why ??

Posted: Sat Jan 14, 2017 9:09 am
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 ?

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

Posted: Sat Jan 14, 2017 9:55 am
by gautamz07
I saw this answer here ,
http://stackoverflow.com/a/20795986/4381665

but how do i solve the problem

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

Posted: Sat Jan 14, 2017 9:59 am
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.

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

Posted: Sun Jan 15, 2017 5:05 am
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 .

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

Posted: Sun Jan 15, 2017 5:17 am
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.

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

Posted: Sun Jan 15, 2017 5:58 am
by gautamz07
ok thanks requinix.

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

Posted: Sun Jan 15, 2017 8:11 am
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.

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

Posted: Mon Jan 16, 2017 4:34 am
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 ?

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

Posted: Mon Jan 16, 2017 9:50 am
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?

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

Posted: Tue Jan 17, 2017 12:01 pm
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 ?

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

Posted: Tue Jan 17, 2017 1:50 pm
by Celauran
And you've checked that the tables actually exist? I'd listen to the error message.