PHP mysql_fetch_array不起作用?

Im trying to fetch an array out of a Mysql query result :

    $result = mysqli_query($con,"SELECT * FROM names");

    if (!$result) {
   echo "WRONG";
}
    var_dump($result);

      //Fetch the data in a loop
      while($r=mysql_fetch_array($result, MYSQL_ASSOC)){

        var_dump($r);

      }

var_dump($result); shows me that there is something in it :

object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(6) ["lengths"]=> NULL ["num_rows"]=> int(2) ["type"]=> int(0) }

but why i never get a:

var_dump($r); call

You are mixing mysql_ functions with mysqli_ functions

Change your fetch to

$r = mysqli_fetch_array()

You did mistake in mysql_fetch_array while($r=mysqli_fetch_array($result, MYSQL_ASSOC)){

    var_dump($r);//write mysqli_fetch_array

  }