У меня есть две таблицы: TOPICS и USERS.
Код здесь (не написан мной) выбирает значения таблицы TOPICS и присваивает их массиву:
$sql = 'SELECT forum_id, topic_id, topic_title, topic_time, topic_views, topic_poster, topic_posts_approved, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_view_time, topic_last_poster_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('forum_id', $flast) . '
AND ' . $this->content_visibility->get_visibility_sql('topic', 'topic') . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['last_total']);
while ($row = $this->db->sql_fetchrow($result))
{
$this->template->assign_block_vars('last_topic', array(
'LAST_LINK' => append_sid("{$this->phpbb_root_path}viewtopic.$this->phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
'U_LAST_TOPIC' => append_sid("{$this->phpbb_root_path}viewtopic.$this->phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']),
'LAST_POSTER' => append_sid("{$this->phpbb_root_path}memberlist.$this->phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']),
'USERNAME_LAST' => append_sid("{$this->phpbb_root_path}memberlist.$this->phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']),
'TOPIC_TITLE' => $row['topic_title'],
'TOPIC_VIEWS' => $row['topic_views'],
'TOPIC_REPLIES' => $row['topic_posts_approved'],
'TOPIC_LAST_POSTER_NAME' => $row['topic_last_poster_name'],
'TOPIC_LAST_POSTER_COLOUR' => $row['topic_last_poster_colour'],
'TOPIC_LAST_POST_TIME' => $this->user->format_date($row['topic_last_post_time']),
'TOPIC_LAST_VIEW_TIME' => $this->user->format_date($row['topic_last_view_time']),
'USERNAME_AV' => "test",
));
}
$this->db->sql_freeresult($result);
Последний элемент вмассив "USERNAME_AV".Я хочу присвоить ему данные из таблицы USERS, где строка таблицы / идентификатор пользователя = topic_last_poster_id (взяты из таблицы TOPICS), но не уверен, что это можно сделать внутри массива.
Любые предложения приветствуются!