문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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

$user = DB::select('*')->from("users")->where('username', '=', $username)->execute()->current();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top