0
我宣布一个公共职能在我的控制器:Laravel 4原始查询
public function deaths()
{
$getdeaths = DB::statement('SELECT * FROM player_deaths ORDER BY time DESC LIMIT 10');
return View::make('main.latestdeaths')->with('getdeaths', $getdeaths);
}
然后我试着检索数据:
<td>{{ $getdeaths->player_id }}</td>
但它不工作。获取Trying to get property of non-object
错误。是否有可能检索它或?
仍然得到同样的错误,那'{{$ getdeaths-> player_id}}'高亮显示。 –
看起来像你的查询没有返回行...尝试dd($ getdeaths)在你的死亡()方法。 –
一切看起来都很好.. http://paste.laravel.com/K3S –