You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Define the table and get all the fields
$ormdb_channels = $ormdb->channel()->select("*")->where("channel.user_id=?", $_SESSION['user_id']);
$ormdb_channel = $ormdb_channels->fetch();
$channel_arr = (array) $ormdb_channel->getIterator();
$channel_arr["user"] = (array) $ormdb_channel->user->getIterator();
still want to know a correct way (and probably my way is getting only one row/field instead of multiple)
The text was updated successfully, but these errors were encountered:
// way 1: loop result set
foreach (user_channels as $user_channel) {
echo $user_channel['username'];
}
// way 2: get result set as associative array
$user_channels_assoc = array_map('iterator_to_array', iterator_to_array($user_channels));
foreach (user_channels_assoc as $user_channel) {
echo $user_channel['username'];
}
how do i output all rows as an assoc array with relations?
It outputs just fine, but what if i want to output only channels with
$ormdb_channels->user["username"]
?i.e.
case 2: same but with a whole related user
Upd:
still want to know a correct way (and probably my way is getting only one row/field instead of multiple)
The text was updated successfully, but these errors were encountered: