Jump to content

Database Tables - Select and Show Data


Recommended Posts

Hey people,

I wanted to ask if anyone knows a way to load exact columns of a row from a table in the database (the table that is not related to Pages app). I've created a new table and I named it "server_players". This table stores the member ID from the forum (I used PHP to load core_members table and get this data if user logins in-game), so basically the table stores user IDs that match member IDs from core_members table. 

What I am trying to achieve is something like - if the user ID from server_players matches the member_id from core_members table, then load other columns from that table row where user ID = member ID.

So far, I have used: 

{{$member_ids = \IPS\Db::i()->select( 'idign', 'server_players' );}}                            *idign = User ID in Forums.

{{foreach $member_ids as $id}}
    {{if $member->member_id == $id}}
        <strong>Found Member (ID {$id})</strong>

This finds the matching ID of a member. What i'd like it to do next, is to start loading data from other columns of the same row where user ID == member ID.

This is essential for my community and therefore I'd really appreciate any sensible suggestions!



If it's hard to understand what I'm on about, I'll add some extra info. 

I am trying to get columns from other database table (server_players) and not (core_members). Rank, name etc. are all located in core_members table, the data I want to load is located in server_players table.

The data is for example in-game nickname. So in ENGLISH, the algorithm would sound like this:

IF USER_ID in server_players == member_id in core_members DO
select nickname from table server_players where USER_ID == MEMBER_ID

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...