Using Medoo PHP database framework and trying to make a join
$users = $db->select(
'users',
[
'[>] tournaments_users' =>
[
'tournaments_users.user_id' => 'users.uid'
]
], [
'users.uid',
'users.name',
'users.modifier',
'users.handicap',
'tournaments_users.tournament_id'
], [
'tournaments_users.tournament_id' => 1
'ORDER' => 'users.username ASC'
]
);
foreach( $users as $u) {
echo $u['name'].'<br>';
}
The selection results in an invalid argument supplied for foreach().
Removing 'tournaments_users.tournament_id' from the column- and where-section makes the query work, but does not show the correct data.
Why is the query invalid?
Changing the join-selection to
'[>]tournaments_users' =>
[
'uid' => 'user_id'
]
solved the issue with invalid argument.