In this tutorial learn how to retrieve a single row/columns/record using database query, If you want to retrieve a single row/record from the database table, you may use the first method. This method will return a single stdClass object.
and display record.
If you don't even need an entire row, you may extract a single value from a record using the value method. This method will return the value of the column directly:
and display record.
$singleRecord = DB::table('users')->where('name', 'Nakiya')->first();
echo $singleRecord->name;
If you don't even need an entire row, you may extract a single value from a record using the value method. This method will return the value of the column directly:
$add = DB::table('users')->where('name', 'Nakiya')->value('address');
echo $add->address;
No comments:
Post a Comment