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());
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?
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?
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?
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);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community