• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

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

StreetNet - Private Top List Code Error - RaGEZONE Forums

Uploaded with imagestreet.co.cc

Thank's
 
Joined
Jun 8, 2007
Messages
1,985
Reaction score
490
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