Texas
Texas

Reputation: 453

Can't retrieve data from tables in laravel

I can't perform any 'select' query in any tables. DB::table, ->where(condition), ::find($something)... nothing works... I can insert data into the tables, but I can't retrieve anything.

I keep getting this error:

Call to a member function where() on a non-object

Has anyone encountered this problem before?

Any suggestion?

Upvotes: 1

Views: 793

Answers (1)

Texas
Texas

Reputation: 453

I haven't posted any code because I didn't know where the error is coming from. So I went backwords to the last moment I remembered that the error appeared. So the problem comes from DB::table('TableName')->where(...)->get() For my table I use Eloquent and DB::tableand where(...) don't work in this case.. this is what i've found on the internet. I don't get the error if I use $results=TableName::find(...)

Since I'm very new to laravel5 it would be perfect if an experienced member could confirm what I've posted above.

Upvotes: 1

Related Questions