Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Undefined index when performing query
  • What does the error "Fuel\Core\PhpErrorException [ Notice ]:
    Undefined index:" mean?

    It happened when running this function:

    $groups = Model_Tmgroup::query()
                        ->where('owner_id', '=', $user_id)
                        ->related('tmfriends')
                        ->get();


  • atabakatabak
    Accepted Answer
    if owner_id in tmfriends relation, you must use


    $groups = Model_Tmgroup::query()
                        ->related('tmfriends')
                        ->where('tmfriends.owner_id', '=', $user_id)
                        ->get();
  • PHPErrorException's are standard PHP errors that are wrapped in an exception so they can be caught and handled. So this is a standard PHP notice.

    And it should tell you exactly where in the code it happens, in development mode exceptions are shown with a backtrace with code snippets.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion