Support the ongoing development of Laravel.io →
Database Blade

Hi guys,

Hope you can help me with this simple query. I have this function.

    public function CapTracker()
    {
        $get_tracker_data = DB::select("select neighbourhood, agent_first_name, agent_last_name, cap_tracking.add_date from cap_tracking, neighbourhoods, client_assurance_members where cap_tracking.neighbourhood_id = neighbourhoods.neighbourhood_id and cap_tracking.agent_id = client_assurance_members.id");
        
        return view('admin.cart.cap-tracker-list')->with('get_tracker_data', $get_tracker_data);
    }

What is wrong with this?? If I copy that query and run it directly on the server I get the 5 results as expected..... very confused here.

Thanks.

Last updated 3 years ago.
0

What's the error message?????

0

Hi there!

On my view I have this:

@foreach($get_tracker_data as $get_tracker_data)
                                    <tr>
                                        <td><?php echo $get_tracker_data->neighbourhood;?></td>
                                        <td><?php echo $get_tracker_data->agent_first_name.' '.$get_tracker_data->agent_last_name;?></td>
                                        <td><?php echo $get_tracker_data->add_date;?></td>
                                    </tr>
@endforeach

And I'm getting the error: "Trying to get property of non-object" on the first line in php where I echo.

I did this EXACT same process on another function and view and it worked fine. Thanks.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

playstone playstone Joined 5 Jun 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.