Jump to content

My Php Problem


help me please

Recommended Posts

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sphinx/public_html/hforums/dodianv2/index.php on line 69

 

my query:

<?php
session_start();

?>
<html>
<head>
<?php
include "functions.php";
?>
<style type="text/css">
body {
color: white;
background-color: grey;
font-family: Verdana, Arial, Sans-Serif;
font-size: 15px;
}
a
{
color: white;
text-decoration: none;
}
a:hover
{
color: gray;
text-decoration: underline;
}
tr
{
font-size: 15px;
}
tr#top
{
background-image: url('images/top.PNG');
color: black;
font-weight: bold;
}
a#top
{
color: black;
}
tr#tabletop
{
background-image: url('images/tabletop.PNG');
}
</style>
<title>The-Lost-Isle StatusPage</title>
</head>
<body>
<?php
include "connect.php";
echo "<center>";
if(isset($_SESSION['admin']))
{
echo '<table cellpadding="2" border="1" width="100%">';
}
else
{
echo '<table cellpadding="2" border="1" width="70%">';
}
if(isset($_SESSION['admin']))
{
echo '<tr id="tabletop"><td><strong>IP</strong></td><td><strong>Port</strong></td><td><b>Type</b></td><td><strong>Status</strong></td><td><strong>Edit</strong></td><td><strong>Delete</strong></td><td><strong>Ban</strong></td></tr>';
}
else
{
echo '<tr id="tabletop"><td><strong>IP</strong></td><td><strong>Port</strong></td><td><b>Type</b></td><td><strong>Status</strong></td></tr>';
}
$k = mysql_query("SELECT * FROM servers ORDER BY top");
while($l = mysql_fetch_array($k))
{
    $check = @fsockopen($l['ip'],$l['port'],$errorNumber,$errorMessage,1);
    if($check){
        if(isset($_SESSION['admin']))
        {
        if($l['top'] == 0)
          {
          echo '<tr id="top"><td><a id="top" href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%" style="background-color: black;"><img src="images/online.png"></td><td width="5%"><a id="top" href="edit-server.php?id='. $l["id"] .'">Edit</a></td><td width="5%"><a id="top" href="delete-server.php?id='. $l["id"] .'">Delete</a></td><td width="5%"><a id="top" href="ban-ip.php?ip='. $l["ip2"] .'">Ban</a></td></tr>';
          }
          else
          {
          echo '<tr><td><a href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%"><img src="images/online.png"></td><td width="5%"><a href="edit-server.php?id='. $l["id"] .'">Edit</a></td><td width="5%"><a href="delete-server.php?id='. $l["id"] .'">Delete</a></td><td width="5%"><a href="ban-ip.php?ip='. $l["ip2"] .'">Ban</a></td></tr>';
          }
        }
        else
        {
        if($l['top'] == 0)
          {
          echo '<tr id="top"><td><a id="top" href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%" style="background-color: black;"><img src="images/online.png"></td></tr>';
          }
          else
          {
          echo '<tr><td><a href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%"><img src="images/online.png"></td></tr>';
          }
        }
    } else {
        if(isset($_SESSION['admin']))
        {
        if($l['top'] == 0)
          {
          echo '<tr id="top"><td><a id="top" href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%" style="background-color: black;"><img src="images/offline.png"></td><td width="5%"><a id="top" href="edit-server.php?id='. $l["id"] .'">Edit</a></td><td width="5%"><a id="top" href="delete-server.php?id='. $l["id"] .'">Delete</a></td><td width="5%"><a id="top" href="ban-ip.php?ip='. $l["ip2"] .'">Ban</a></td></tr>';
          }
          else
          {
          echo '<tr><td><a href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%"><img src="images/offline.png"></td><td width="5%"><a href="edit-server.php?id='. $l["id"] .'">Edit</a></td><td width="5%"><a href="delete-server.php?id='. $l["id"] .'">Delete</a></td><td width="5%"><a href="ban-ip.php?ip='. $l["ip2"] .'">Ban</a></td></tr>';
          }
        }
        else
        {
        if($l['top'] == 0)
          {
          echo '<tr id="top"><td><a id="top" href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%" style="background-color: black;"><img src="images/offline.png"></td></tr>';
          }
          else
          {
          echo '<tr><td><a href="view.php?server='. $l['id'] .'">'. $l["name"] .'</a></td><td>'. $l["ip"] .'</td><td>'. $l["port"] .'</td><td>'. $l["type"] .'</td><td width="5%"><img src="images/offline.png"></td></tr>';
          }
        }
    } 
  }
  echo "</table><br>";
  echo "<a href='addserver.php'>Add Server</a><br>";
  if(isset($_SESSION['admin']))
  {
  echo "<a href='logout.php'>Logout</a>";
  }
  else
  {
  echo "<a href='login.php'>Login</a>";
  }
  echo "<br><br><br><Br><b><font color='yellow'>For information. You can talk to l1ttlesoft@live.co.uk on msn</b></font>";
  echo "</center>";
/*}*/
?> 

 

anyhelp

 

 

Link to comment
Share on other sites

The query would have returned an error and it then triggers the error in the loop. Try changing the lino to this:

 

$k = mysql_query("SELECT * FROM servers ORDER BY top") or die(mysql_error());

 

It will show what you have done wrong in the query.

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.