Jump to content

Help to solve these 2 errors


welshy123

Recommended Posts

Sorry Im A Noob When It Comes To Php Lol. thanks

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mafiamur/public_html/online.php on line 127

 

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/mafiamur/public_html/online.php on line 133

 

 

<?
session_start();
include "includes/functions.php";
include "includes/db_connect.php"; 
logincheck();
$username=$_SESSION['username'];

$total_regged=mysql_num_rows(mysql_query("SELECT * FROM users"));
$admins=mysql_num_rows(mysql_query("SELECT * FROM users WHERE userlevel='3'"));
$total_regged=mysql_num_rows(mysql_query("SELECT * FROM users"));
$admins=mysql_num_rows(mysql_query("SELECT * FROM users WHERE userlevel='2'"));
$mods=mysql_num_rows(mysql_query("SELECT * FROM users WHERE userlevel='1'"));
$iti=mysql_fetch_object(mysql_query("SELECT * FROM site_stats WHERE id='1'"));
$most=$iti->online;
?>
<body>
<style type="text/css">

#skill{
position: absolute;
width: 150px;
border: 1px solid black;
padding: 2px;
background-color: white;
visibility: hidden;
z-index: 100;

}

</style>
</body><head>
<div id="skill"></div>

<script type="text/javascript">


var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["skill"] : document.getElementById? document.getElementById("skill") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function tip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hide(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

</script></body>
<html><head><link rel="stylesheet" href="includes/in.css" type="text/css">
<script type="text/javascript" src="includes/overlib.js"></script><style type="text/css">
<!--
.style1 {color: #fbf7f7}
.style2 {color: #fbf7f7}
-->
</style></head><div id=overDiv style="position:absolute; visibility:hidden; z-index:1000;"></div>

</head>

<body>
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="3">
  <tr> 
    <td><table class="main" width=100% border="1" cellpadding="2" cellspacing="0" bordercolor=black>
        <tr> 
          <td class=tableheading><center class=bold>
              Users Online </center></td>
        </tr>
        <tr bgcolor=white>
          <td class=tip><div align="center">Users online in past 10mins.</div></td>
        </tr>
        
          <td class=tablearea align=center>
            <?
			$timenow=time();
$select = mysql_query("SELECT * FROM users WHERE online > '$timenow' AND ghostmode='0' ORDER by id ASC");
$num = mysql_num_rows($select);
if ($num > $most)
{
  mysql_query("UPDATE `site_stats` SET `online`=$num WHERE id='1'");
}

while ($i = mysql_fetch_object($select)){
if ($i->crew == "0"){
$crew="None";
}else{
$crew=$i->crew;
}
if ($i->last_oc > time()){
$oc="<font color=red>Unavaliable</font>";
}else{
$oc="<font color=green>Avaliable</font>";
}
if ($i->get_away_time > time()){
$ga="<font color=red>Unavaliable</font>";
}else{
$ga="<font color=green>Avaliable</font>";
}

if($i->userlevel=="1"){
$echo = "<font color=green>$i->username</font>";
}elseif ($i->userlevel=="2"){
$echo = "<font color=yellow>$i->username</font>";
}elseif ($i->userlevel=="3"){
$echo = "<font color=orange>$i->username</font>";
}elseif ($i->userlevel=="4"){
$echo = "<font color=0077ff>$i->username</font>";
}elseif ($i->userlevel=="5"){
$echo = "<font color=red>$i->username</font>";
}elseif ($i->userlevel=="6"){
$echo = "<font color=black>$i->username</font>";
}else{
$echo = "$i->username";
}
$don=mysql_num_rows(mysql_query("SELECT * FROM donaters WHERE username='$i->username'"));
if ($don != "0"){
$echo .= "<font color=GOLD>*</font>";
}
$rhm=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE rhm='$i->username'"));

if ($rhm != "0"){
$echo = "<i>$echo</i>";

}

$leader=mysql_num_rows(mysql_query("SELECT * FROM crews WHERE owner='$i->username'"));

if ($leader != "0"){
$echo = "<b>$echo</b>";

}


$friend=mysql_num_rows(mysql_query("SELECT * FROM friends WHERE person='$i->username' AND type='Friend' AND username='$username'"));
if ($friend != "0"){
$echo = "<u>$echo</u>";

}



echo "<a href='profile.php?viewuser=$i->username' onMouseover=\"tip('<b>Username:</b> <i>$i->username</i> <br><b>Crew:</b> <i>$crew</i><br><b>OC Status:</b> <i>$oc</i><br><b>GA Status:</b> <i>$ga</i><br><b>Rank:</b> <i>$i->rank</i>')\";
onMouseout=\"hide()\"> $echo </a>,";

} ?>
          </td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td> 
      <table width="136" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor=black class="main">
        <tr> 
          <td class=tableheading><center>
              Total Online </center></td>
        </tr>

       
         <tr>
          <td class=tablearea><div align="center"><font color="#0000FF"><?php echo "$num"; ?></font> 
            </div></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
     <td width="50%"><table width="50%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class="main">
      <tbody>
        <tr>
          <td class=tableheading colspan="3" class="header" scope="col"><center>User Key</center></td></td>
        </tr>
        <tr>
          <td  scope="col" bgcolor="red" width="83"> </td>
          <td class=tablearea width="258" colspan="2" class="style16" scope="col">- Owner</td>
        </tr>
        <tr>
          <td  scope="col" bgcolor="orange" width="83"> </td>
          <td class=tablearea width="258" colspan="2" class="style16" scope="col">- Admin</td>
        </tr>
        <tr>
          <td  height="5" bgcolor="green" scope="col"> </td>
          <td class=tablearea colspan="2" class="style16" scope="col">- Moderator</td>
        </tr>
        <tr>
          <th class=tablearea height="5" scope="col"><font color="#FFFF00">*</font></th>
          <td class=tablearea colspan="2" class="style16" scope="col">- Donators.</td>
        </tr>
         <tr>
          <th class=tablearea height="5" scope="col"><strong>BOLD</strong></th>
          <td class=tablearea colspan="2" class="style16" scope="col">- Crew Owners </td>
        </tr>
        <tr>
          <th class=tablearea height="5"  scope="col"><em>Italic</em></th>
          <td class=tablearea colspan="2" class="style16" scope="col">- Family RHM </td>
        </tr>
        <tr>
          <th class=tablearea height="5"  scope="col"><u>Underlined</u></th>
          <td class=tablearea colspan="2" class="style16" scope="col">- These are your friends. </td>
        </tr>
      </tbody>
    </table></td>
  </tr>
</table>
</table>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/177001-help-to-solve-these-2-errors/
Share on other sites

hey yeh sorry..

 

 

$timenow=time();
$select = mysql_query("SELECT * FROM users WHERE online > '$timenow' AND ghostmode='0' ORDER by id ASC");
$num = mysql_num_rows($select);
if ($num > $most)
{
  mysql_query("UPDATE `site_stats` SET `online`=$num WHERE id='1'");
}

while ($i = mysql_fetch_object($select)){
if ($i->crew == "0"){
$crew="None";
}else{
$crew=$i->crew;
}

 

 

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.