i’ve been away from coding for many years and now im struggling to do the most basic things if anyone could help me display my php print_r results into a boot strap table i’d be mega great full the results i get are [gq_address] [gq_gametype] [gq_hostname] [players]
i’d like to display them into the following code, i’ve added markers to the table what needs to be called into which table.
the purpose of this code is to pull game server results such as ip,name,players,servername etc and display it into plain text once i’ve managed to print them into the tables ill remove the print_r from the php
<?php
require_once('GameQ/Autoloader.php');
$GameQ = new \GameQ\GameQ();
$GameQ->addServer([
'type' => 'css',
'host' => '46.105.73.18:27015',
]);
$results = $GameQ->process();
print_r($results);
?>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Defcon Gaming</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<table class="table table-striped table-dark">
<thead>
<tr>
<th scope="col">List</th>
<th scope="col">Address</th>
<th scope="col">Game Type</th>
<th scope="col">Server Name</th>
<th scope="col">Players</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>List</td>
<td> <?php echo $results[gq_address]; ?> </td> <!-- Display print_r data table here-->
<td> <?php echo $results[gq_gametype]; ?> </td> <!-- Display print_r data table here-->
<td> <?php echo $results[gq_hostname]; ?> </td> <!-- Display print_r data table here-->
<td> <?php echo $results[players]; ?> </td> <!-- Display print_r data table here-->
</tr>
</tr>
</tbody>
</table>
</html>
this is the data i get below, i want to display each array singly into the table like gq_address which is the ip then gq_hostname which is server name then players i had this before but lost all my files years ago just trying to recreate my old server page from 2016 xD
Array ( [46.105.73.18:27015] => Array ( [gq_address] => 46.105.73.18 [gq_dedicated] => [gq_gametype] => [gq_hostname] => [gq_joinlink] => steam://connect/46.105.73.18:27015/ [gq_mapname] => [gq_maxplayers] => [gq_mod] => [gq_name] => Counter-Strike: Source [gq_numplayers] => [gq_online] => [gq_password] => [gq_port_client] => 27015 [gq_port_query] => 27015 [gq_protocol] => source [gq_transport] => udp [gq_type] => css [players] => Array ( ) [teams] => Array ( ) ) )
image of the table obv bugged due to php error but i’d like to display the info to the table horizontally image
the erorr is
Fatal error: Uncaught Error: Undefined constant “gq_gametype” in E:\xampp\htdocs\test.php:44 Stack trace: #0 {main} thrown in E:\xampp\htdocs\test.php on line 44
line 44 <td> <?php echo $results[gq_gametype]; ?> </td>