https://supabase.com/ logo
Join Discord
Powered by
# help
  • f

    Flyken

    07/27/2021, 5:20 PM
    i want that data
  • f

    Flyken

    07/27/2021, 5:20 PM
    i think..
  • f

    Flyken

    07/27/2021, 5:20 PM
    im basically wanting to allow users to "add" games to their profile
  • f

    Flyken

    07/27/2021, 5:20 PM
    so each user can sub to games, in which like
  • f

    frubalu

    07/27/2021, 5:20 PM
    ok, so you're trying to get data from
    users_games
    table through
    game_directory
  • f

    Flyken

    07/27/2021, 5:21 PM
    the user can have many "games" from "game_directory" to their profile
  • f

    Flyken

    07/27/2021, 5:21 PM
    uuhhhh
  • f

    Flyken

    07/27/2021, 5:21 PM
    yea
  • f

    Flyken

    07/27/2021, 5:21 PM
    :l
  • f

    Flyken

    07/27/2021, 5:21 PM
    i think i see where this is going
  • f

    Flyken

    07/27/2021, 5:21 PM
    so basically each column will contain a new entry for every game
  • f

    Flyken

    07/27/2021, 5:21 PM
    so lets say im subbed to 2 games
  • f

    frubalu

    07/27/2021, 5:22 PM
    yea in that case,
    users_games
    would have two rows
  • f

    Flyken

    07/27/2021, 5:22 PM
    like this
  • f

    Flyken

    07/27/2021, 5:22 PM
    yea
  • f

    frubalu

    07/27/2021, 5:22 PM
    both rows would have the same user_id, with two different game_directory_ids
  • f

    Flyken

    07/27/2021, 5:22 PM
    then i can just grab every entry that has their userid
  • f

    frubalu

    07/27/2021, 5:22 PM
    so theoretically you could directly access that table
  • f

    Flyken

    07/27/2021, 5:22 PM
    yea
  • f

    Flyken

    07/27/2021, 5:23 PM
    :l
  • f

    Flyken

    07/27/2021, 5:23 PM
    right
  • f

    Flyken

    07/27/2021, 5:23 PM
    Copy code
    js
    let { data, error } = await supabase.from('game_directory').select(`*`).eq('id', user.id);
  • f

    frubalu

    07/27/2021, 5:23 PM
    Copy code
    let { data, error } = await supabase.from('users_games').select().eq('id', user.id);
  • f

    Flyken

    07/27/2021, 5:23 PM
    oh right yea
  • f

    Flyken

    07/27/2021, 5:23 PM
    same idea though
  • f

    Flyken

    07/27/2021, 5:24 PM
    well
  • f

    Flyken

    07/27/2021, 5:24 PM
    lets hold on that for right now
  • f

    Flyken

    07/27/2021, 5:24 PM
    why is it returning undefined on page load?
  • f

    Flyken

    07/27/2021, 5:24 PM
    but not when i edit the file and save
  • s

    Scott P

    07/27/2021, 5:24 PM
    Maybe I'm misreading your
    .eq()
    call above, but wouldn't that be pulling
    game_directory.id
    - which should be unique (and not a user ID)? Do you have a
    hosted_by_user
    field (or something similar) which you can link to
    users.id
    ?
12345...316Latest