title: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, string given in while-loop
body: <p>I currently have this code but it gives me the error  <code>mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, string given on line 22</code></p>
  
  <p>The code is this: </p>
  
  <pre><code>1   $servername = "localhost";
  2   $user = "root";
  3   $pass = "";
  4   $db = "mafioso";
  5
  6   $con = mysqli_connect($servername, $user, $pass, $db);
  7
  8   $cash_utbetaling[0] = 50000000;
  9   $cash_utbetaling[1] = 40000000;
  10  $cash_utbetaling[2] = 30000000;
  11  $cash_utbetaling[3] = 20000000;
  12  $cash_utbetaling[4] = 10000000;
  13
  14  $kuler_utbetaling[0] = 25;
  15  $kuler_utbetaling[1] = 20;
  16  $kuler_utbetaling[2] = 15;
  17  $kuler_utbetaling[3] = 10;
  18  $kuler_utbetaling[4] = 5;
  19
  20  $i = 0;
  21  $result = mysqli_query($con, "SELECT * FROM daily_exp ORDER BY exp DESC LIMIT 5");
  22  while($row_best = mysqli_fetch_assoc($result)) {
  23    
  24    $acc_id = $row_best['acc_id'];
  25
  26    $sql = "SELECT * FROM accounts WHERE ID='".$acc_id."'";
  27    $query = mysqli_query($con, $sql) or die (mysqli_error());
  28    $row_top5 = mysqli_fetch_assoc($query);
  29    
  30    $result = "UPDATE accounts SET money = (money + ".$cash_utbetaling[$i]."), 
        bullets = (bullets + ".$kuler_utbetaling[$i].")  WHERE ID = ".$acc_id."";
  31    mysqli_query($con, $result) or die("Bad query: $result");
  32
  33    $i++;
  34  }
  </code></pre>
  
  <p>I can't seem to find the error, I am running the same code in another file and there is no issues.</p>