私は次のような配列を持っています:
Array (
[0] => stdClass Object ( [ID] => 1 [user_id] => 1 [post_id] => 929,924,875,839,850,720,642,1109,917,935,911,1174,1173,1172,903,892,1189,865,1386 )
[1] => stdClass Object ( [ID] => 2 [user_id] => 75 [post_id] => 903,704,477,9,455 )
[2] => stdClass Object ( [ID] => 3 [user_id] => 78 [post_id] => 917,911 )
[3] => stdClass Object ( [ID] => 4 [user_id] => 80 [post_id] => 903,1109,642 )
)
各要素をループする foreach ループを作成しました。
$apples = $wpdb->get_results("SELECT ID, user_id, post_id FROM table_name" );
foreach ( $apples as $apple )
{
$user_info = get_userdata($apple->user_id);
$post_title = get_the_title($apple->post_id);
echo '<ul><li>' . $user_info->user_login . '</li>';
echo '<li>' . $post_title . '</li>';
echo '</ul>';
}
で見つかった各 ID をループするにはどうすればよい[post_id]
ですか? 現在、 の最初の桁のタイトルのみが表示されてい[post_id]
ます。ただし、それぞれをループする必要があります。何か案は?