Ok i no the problem it is the while loop it goes over the same result over and over again i think it is the 2 public function and for some reason it loops over the same result (i think) and it cause browser (FireFox) to crash.

<?php
class player
	{
		public function onlinePlayers(){
			global $cxn;
			$sql = "SELECT * FROM `characters` WHERE `online`='1'";
			@$result = mysqli_query($cxn, $sql);
			if(@mysqli_num_rows($result)){$onlinePlayers=mysqli_num_rows($result);}
			else{$onlinePlayers="0";}
			return $onlinePlayers;

	}
	public function onlineGM(){
		global $cxn;
		$sql = "SELECT * FROM `accounts` WHERE `gm`!=''";
		$result = mysqli_query($cxn, $sql);
		$i=0;
			while(@$row = mysqli_fetch_assoc($result)){
		$sql = "SELECT * FROM `characters` WHERE `acct`='".$row['acct']."' AND `online`='1'";
		@$result = mysqli_query($cxn, $sql);
		if(@mysqli_num_rows($result)){$i++;}
			}
		return $i;
	}
}




$playerStat = new player;

?>

    Its because you have that @$result = mysqli_query($cxn, $sql); inside your while statement. It never reaches the last row because it starts all over again with every cycle. If you have to do another query inside while statement, dont use the same variable for $result. Use $result2 or something else than $result which is used by the while statement..

       public function onlineGM(){ 
                  global $cxn; 
                  $sql = "SELECT count(*)
                              FROM accounts, characters
                              WHERE accounts.acct=characters.acct
                              AND gm <>''
                              AND online";  
      $result = mysqli_query($cxn, $sql); $row = mysqli_fetch_array($result)); return $row[0]; }

        Parse error: syntax error, unexpected T_WHILE in C:\wamp\www\adm\inc\class.php on line 20

        <?php
        //Scripted by BradMasterX;
        class player
        	{
        		public function onlinePlayers(){
        			global $cxn;
        			$sql = "SELECT * FROM `characters` WHERE `online`='1'";
        			@$result = mysqli_query($cxn, $sql);
        			if(@mysqli_num_rows($result)){$onlinePlayers=mysqli_num_rows($result);}
        			else{$onlinePlayers="0";}
        			return $onlinePlayers;
        
        	}
        	public function onlineGM(){
        		global $cxn;
        		$sql = "SELECT * FROM `accounts` WHERE `gm`!=''";
        		$result = mysqli_query($cxn, $sql);
        		$i=0;
        		@$row = mysqli_fetch_assoc($result)
        			while($row){
        		$sql = "SELECT * FROM `characters` WHERE `acct`='".$row['acct']."' AND `online`='1'";
        		@$result2 = mysqli_query($cxn, $sql);
        		if(@mysqli_num_rows($result2)){$i++;}
        			}
        		return $i;
        	}
        }
        
        
        
        
        $playerStat = new player;
        ?>

          or to use the suggestion before mine:

          public function onlineGM(){ 
                      global $cxn; 
                      $sql = "SELECT * FROM `accounts` WHERE `gm`!=''"; 
                      $result = mysqli_query($cxn, $sql); 
                      $i=0; 
                          while(@$row = mysqli_fetch_assoc($result)){ 
                      $sql = "SELECT * FROM `characters` WHERE `acct`='".$row['acct']."' AND `online`='1'"; 
                      @$innerresult = mysqli_query($cxn, $sql); 
                      if(@mysqli_num_rows($innerresult)){$i++;} 
                          } 
                      return $i; 
                  } 

            Your error line 20 is missing semicolon at end:
            @$row = mysqli_fetch_assoc($result)

            also
            you will loop forever!!!!!!!!!!!!!!!

            while($row){

            is like saying: while(true)

            you need to have $row change to exit the loop.

              Write a Reply...