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
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>";
}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.