1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Making it show 10 not 1

Discussion in 'Development' started by iCirgio, Mar 17, 2018.

  1. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    I'm trying to make a top 10 kills plugin but it only shows 1 playeplays instead of 10. Can anyone help?

    PHP:
        $top $this->database->query("SELECT * FROM data ORDER BY kills DESC LIMIT 10;");
        
    $i 0;
        
    $sender->sendMessage("§l§7Top 10 Players With Most Kills");

      while(
    $result mysqli_fetch_array($topMYSQLI_ASSOC)){

        
    $place $i 1;
        
    $player $result["name"];
        
    $value $result["kills"];
        
    $sender->sendMessage("§a" $place ". " $player " " $value);
        
    $i $i 1;
                 return 
    true;
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Remove the return from the loop. The return will end execution of the loop (and also the method if it's in a method). It's the basics. http://php.net/manual/en/function.return.php
     
  3. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    Thanks didn't notice that until now
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.