I'm new to PHP.
I have an array:
Array ( [0] => Array ( [0] => Array ( [0] => Michelle_Madison [1] => Ernest_Gregory [2] => JLRP.Player.4596 ) [1] => Array ( [0] => 4 [1] => 2 [2] => 1 ) ) )
I want to put the array into table, name and id like this"
I use foreach and success for table Name but not for ID, can someone help me?
This is my code in PHP:
include ('mta/mta_sdk.php');
$MY_SERVER = [
"host" => "localhost", #The host/IP of your MTA server
"http_port" => 22005, #The HTTP port for your MTA server (Default 22005)
"http_user" => "mta_php_sdk", #The username that we created in the previous step
"http_pass" => "1234567890" #The password for the username that we created
];
#Create a new mta object
$sdk = new mta ( $MY_SERVER['host'], $MY_SERVER['http_port'],
$MY_SERVER['http_user'], $MY_SERVER['http_pass'] );
$mtaServerStats = $sdk->getResource("usercontrolpanel")->call("getServerStats");
$RESOURCE = $sdk->getResource ( "usercontrolpanel" ); # We need to get our resource Object
$RESULT[] = $RESOURCE->call ( "getAllPlayersForWebsite" );
and this on html that I want to collect from array
<tbody>
<tr>
<td width=150 align="center"><h4>ID</td>
<td width=450 align="center"><h4>Player Name</td>
<td width=200 align="center"><h4>Ping</td>
</tr>
<tr>
<?php foreach ( $RESULT [ 0 ] [ 0 ] as $index=>$playername ) { ?>
<td width=150 align="center"><h4><?= $playerid; ?></td>
<td width=450><h4><?= str_replace("_"," ",$playername);?></td>
<td width=200><h4><?=$player["ping"];?></td>
</tr>
<?php } ?>
</tbody>
so I also want to input the ID into the table but I don't know how.
Comments
Post a Comment