Reputation: 305
I'm running Kohana stable release 3.2.0, just downloaded. My database configuration is done and bootstrap contains orm and database modules enabled. So is my model created.
My request looks like this:
$user = ORM::factory('user',$post)->find();
if($user->count_all()){
echo '<pre>';
print_r($user);
echo '</pre>';
}
Basically it should return some data, but it gives me an error.
Database_Exception [ 1103 ]: Incorrect table name '' [ SELECT COUNT(*) AS `records_found` FROM `` ]
Is this normal, that it displays empty table?
$table_name='user';
it still does not see it.Upvotes: 0
Views: 531
Reputation: 5483
$user = ORM::factory('user',$post)->find();
if($user->loaded()){
echo '<pre>';
print_r($user);
echo '</pre>';
}
Use loaded()
method to check that user was successfully loaded from DB.
Upvotes: 1