Question

In Kohana V3 is it possible to return result set as an array() or any method exists?

For example:

$user = DB::select('*')->from("users")->where('username', '=', $username);

If method is there,then it is possible to get password like

echo $user->password;

Is it possible without ORM? Please suggest.

Was it helpful?

Solution

I think the following would give you all results:

$user = DB::select('*')->from("users")->where('username', '=', $username)->as_object()->execute();

Whereas the following here, would give you the first item:

$user = DB::select('*')->from("users")->where('username', '=', $username)->as_object()->execute()->current();

Try: KO3 Database Wiki

OTHER TIPS

You just need to add a ->current() to the end of your query:

$user = DB::select('*')->from("users")->where('username', '=', $username)->execute()->current();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top