jeudi 1 septembre 2016

Returning values from DB laravel 5

Hey guys I have this: $fetchedUser = DB::table('users')->where('first_nome', $nome)->get(); $f_nome = $fetchedUser->first_nome; return ($f_nome);

I want to return the a name and maybe some other data of the fetched user. But I get an error of "Trying to get property of non-object"

So I did this: $fetchedUser = DB::table('users')->where('first_nome', $nome)->get(); return ($fetchedUser);

And I get a long array with the fetched user's info from the DB..

So my question is this, how do i return $nome only?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire