Support the ongoing development of Laravel.io →
posted 9 years ago
Database
Last updated 1 year ago.
0

is the name of the table with a capital "A"? i believe it's case sensitive. also turn on debug so you can see error messages. you can also use dd(DB::getQueryLog());

Last updated 1 year ago.
0

w1n78 said:

is the name of the table with a capital "A"? i believe it's case sensitive. also turn on debug so you can see error messages. you can also use dd(DB::getQueryLog());

The name is with a capital "A", and debug is on. Can't i get all data in the table with User:: since Accounts table is used by User model?

Last updated 1 year ago.
0

hmmm, so when you say "blank page", you mean that there's no resultset, correct? i misunderstood it as there's no error or data being displayed at all, that's why i brought up the debug.

// using
$names = DB::table('Accounts')->get();

// translates to
SELECT * FROM `Accounts`;
// ********************************************************
// using
$names = Accounts::get();

// translates to...
SELECT * FROM `Accounts`;

// assuming in your Accounts.php (model) has
protected = $table = 'Accounts';
// ********************************************************
// using
$names = User::get();

// translates to...
SELECT * FROM `users`;

// assuming User.php (model) has
protected = $table = 'users';

other things i can think of could be to check the protected = $table value, also does the file name of the model match the class name?

Last updated 1 year ago.
0

w1n78 said:

hmmm, so when you say "blank page", you mean that there's no resultset, correct? i misunderstood it as there's no error or data being displayed at all, that's why i brought up the debug.

// using
$names = DB::table('Accounts')->get();

// translates to
SELECT * FROM `Accounts`;
// ********************************************************
// using
$names = Accounts::get();

// translates to...
SELECT * FROM `Accounts`;

// assuming in your Accounts.php (model) has
protected = $table = 'Accounts';
// ********************************************************
// using
$names = User::get();

// translates to...
SELECT * FROM `users`;

// assuming User.php (model) has
protected = $table = 'users';

other things i can think of could be to check the protected = $table value, also does the file name of the model match the class name?

I don't have accounts model, i modified User model, because Accounts holds login info. And if i call User::get(); or DB::table('Accounts')->get();, it just does not work. Anything after that line does not load. If i execute this in the footer, i don't have a footer. If i execute this before loading any html, i have an empty page. Any other table works.

Can the fact that this table has like 40000 entries be the problem?

Last updated 1 year ago.
0

Yes, maybe a memory problem. Try increasing the memory limit, or reducing the amount of rows you want to get. Putting this in your index.php might show some more info:

error_reporting(-1);
ini_set("display_errors", 1);
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joe96 joe96 Joined 28 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.