MySQLi没有返回获取的数据

Basically, I have a php script that queries the database and returns a list of all the usernames in my database. Problem is, it is not printing anything and I think I am doing the while statement incorrectly, this is my code below:

<?php
    include "init.php";

    $stmt = "SELECT username FROM tbl_users ";
    $result = $dbcon -> prepare($stmt);
    $result->execute();
    $result->store_result();
    $count = 0;
    while($row = mysqli_fetch_assoc($result)){
        if($row['username']=="Ben"{
          echo "Here";
        }
        //$count++;
    }

?>

EDIT: Even something as basic as this doesn't work:

<?php
    include "init.php";

    $stmt = "SELECT username FROM tbl_users ";
    $result = $dbcon -> prepare($stmt);
    $result->execute();
    $result->store_result();
    $count = 0;
    while($row = mysqli_fetch_assoc($result)){
          echo "Here";
        //$count++;
    }

?>

I can't also seem to increment the count too and it is not even printing the basic "Here"

I am new to web development so any help will mean a lot to me

Thanks

The main problem is that you are not reading manual/examples properly.

mysqli_stmt_get_result() doesn't change the state of a statement. It returns a mysqli result. So you have to assign this returned value to a variable and than use this one.

Besides, you are using a database completely wrong way. Instead of selecting all rows from database you should always select the only data you need.

For your case the code would be like this.

include "init.php";
$name = "Ben";

$stmt = $dbcon->prepare("SELECT 1 FROM tbl_users WHERE username = ?");
$stmt->bind_param("s", $name);
$stmt->bind_result($found);
$stmt->execute();
$stmt->fetch();

if ($found) ... // here you go

For other cases you have to read the manual or a book carefully. and reproduce the code exactly.

Since there are multiple error in your code i managed to write a code am not sure following is best but it works

<?php
    include "init.php";

    $stmt = "SELECT username FROM tbl_users ";
    $result = mysqli_query($sqlconnection, $stmt) or die($mysqli_load->error);
    $count = 0;
    while($row = mysqli_fetch_assoc($result)){
        if($row['username']=="ben"){
          echo "Here";
        }
        //$count++;
    }
?>

few errors i found in your code are ) is missing here if($row['username']=="Ben"{ next to "ben"){

and use this type of connection

$link = new mysqli("localhost","user","pass","database");