首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Steam API多个SteamID

Steam API多个SteamID
EN

Stack Overflow用户
提问于 2018-01-29 19:37:29
回答 1查看 350关注 0票数 0

我正在尝试为我的MySQL数据库中的多个SteamID生成一个HTML表。我的数据库如下所示:

id | steamid64 | xenforo_username | xenforo_userid

代码语言:javascript
复制
 /*
  * Accountlist Query
  */
  $list = $db->query('SELECT * FROM steamlist ORDER BY id DESC');
  $list = $list->fetch_assoc();

  /*
  * Parse Query Values into Strings
  */
  $steamid = $list['steamid64'];
  $xfUsername = $list['xf_username'];
  $xfUserid = $list['xf_userid'];

  /*
  * Create array for the list
  */
  $steamlist = array( array("Forum Username | "=>$xfUsername, "Steam Username | "=>$steamapi->personaname, "SteamID | "=>$steamid, "Last Logout | "=>$steamapi->lastlogoff, "Onlinestatus"=>$steamapi->personastate)
              );

  /*
  * API URL
  */
    $api_url=file_get_contents("https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?key=$api_key&format=json&steamids=$steamid");
    $api_url = json_decode($api_url);

  /*
  * Parse API URL into variable
  */
  $steamapi = $api_url->response->players[0];

我相信我需要一个foreach函数来从SteamAPI中获取存储在我的数据库中的所有SteamID的信息。有人能帮我一下吗?

EN

回答 1

Stack Overflow用户

发布于 2018-01-29 20:00:55

代码语言:javascript
复制
<table>
<thead>
    <tr>
        <th>STEAMID</th>
        <th>USER NAME</th>
        <th>USER ID</th>
    </tr>
</thead>
<tbody>
    <!--Use a while loop to make a table row for every DB row-->
    <?php while( $row = $list->fetch()) : ?>
    <tr>
        <!--Each table column is echoed in to a td cell-->
        <td><?php echo $row['steamid64']; ?></td>
        <td><?php echo $row['xf_username']; ?></td>
        <td><?php echo $row['xf_userid']; ?></td>
    </tr>
    <?php endwhile ?>
</tbody>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48500365

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档