In fact, in this case you only need to join the two tables (as a general rule, the less joins you make, the better).
Since you know the user ID, you can request it directly from the album table name.
If another column "username" appears in your users_table account and you want to find it, you will need to join the user table.
SELECT filename, album_name, album_id FROM album_table at, images_table it AND at.album_id = it.album_id AND at.user_id = $user_id
source share