Jump to content

[SOLVED] Problem with my Script?


winmastergames

Recommended Posts

Hi well i made this script so you can add Servers to be checked and on another page you can view them but im having problems with viewing the Servers status it doesnt list them all it just lists the first one on the MYSQL database heres the script:

<?php
// connect to db
// select db
$db_host = "MYSQLHOST";
$db_username = "MYSQLUSER";
$db_password = "MYSQLPASS";
$db_name = "MYSQLDB";
$conn = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
mysql_select_db($db_name, $conn) or die(mysql_error());

$myquery = mysql_query("select * from MYSQLDB");

while($r=mysql_fetch_array($myquery)) {

$rowname=$r["name"]; // put your field's name is where "their_website" is
$rowurl=$r["url"]; // put your field's name is where "their_link" is
$rowdescription=$r["description"]; // put your field's name is where "their_description" is

}
?>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="77%"><font face="Arial, Helvetica, sans-serif" size="2"><?php echo "$rowname"; ?></font></td>
<td width="23%"><img src="status.php?link=<?php echo "$rowurl"; ?>" width="37" height="20"></td>
</tr>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="77%"><font face="Arial, Helvetica, sans-serif" size="2"><?php echo "$rowname"; ?></font></td>
<td width="23%"><img src="status.php?link=<?php echo "$rowurl"; ?>" width="37" height="20"></td>
</tr>

 

Whats wrong and if you are trying to figure out what status.php is it just checks the server if its only and displays a image if its online or not

Link to comment
https://forums.phpfreaks.com/topic/83563-solved-problem-with-my-script/
Share on other sites

Your output needs to be inside your loop, like this:

 

$myquery = mysql_query("select * from MYSQLDB");
while($row = mysql_fetch_array($myquery)){
extract($row);
echo"<table border='0' cellspacing='0' cellpadding='3'>
<tr>
<td width='77%'><font face='Arial, Helvetica, sans-serif' size='2'>$name</font></td>
<td width='23%'><img src='status.php?link=$url' width='37' height='20'></td>
</tr>";
}

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.