Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Private Top List Code Error

Junior Spellweaver
Joined
Jul 1, 2012
Messages
112
Reaction score
36
Hello all RageZone

Why don't get Ip status look the code.

please say me why don't print status?


<?php $result = mysql_query("SELECT * FROM _Server");

echo "<table border='1'>
<tr>
<th>ServerName</th>
<th>Players</th>
<th>Level Cap</th>
<th>Experience</th>
<th>Status</th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ServerName'] . "</td>";
echo "<td>" . $row['Level_Cap'] . "</td>";
echo "<td>" . $row['Level_Cap'] . "</td>";
echo "<td>" . $row['Exp_Rate'] . "</td>";
echo "<td>".$ServerIP=$row['$Server_IP'];
$ServerPort=$row['$Server_Port'];
$IP = "$ServerIP";
$Port = "$ServerPort";
$status = checkState($IP,$Port);
if ($status) echo '<span style="color: green;font-weight:bold;">Online</span>';
else echo '<span style="color: red;font-weight:bold;">Offline</span>';
"</td>";
echo "</tr>";
}
echo "</table>";
?>

and only print



Uploaded with

Thank's
 
Joined
Jun 8, 2007
Messages
1,979
Reaction score
488
You used '$' in your array index:
PHP:
echo "<td>".$ServerIP=$row['$Server_IP'];

I think you meant to put this:
PHP:
echo "<td>".$ServerIP=$row['Server_IP'];

But really you shouldn't be using assignments there, here, try messing with this code:
PHP:
function serverStatusString ($ip, $port) {
	if (checkState($ip, $port)) {
		return '<span style="color: green;font-weight:bold;">Online</span>';
	}
	return '<span style="color: red;font-weight:bold;">Offline</span>';
}
while($row = mysql_fetch_array($result)) {
	echo '
	<tr>
		<td>' . $row['ServerName'] . '</td>
		<td>' . $row['Level_Cap'] . '</td>
		<td>' . $row['Level_Cap'] . '</td>
		<td>' . $row['Exp_Rate'] . '</td>
		<td>' . serverStatusString($row['Server_IP'], $row['Server_Port']) . '</td>
	</tr>';
}
 
Last edited:
Back
Top