I have a table which assigns all users an ID number. I am trying to fetch all those ID's and add them into an array for use with a foreach. The method I am using below is not working for me. The array is not being populated with the data from MYSQLi. Can anyone spot any issues?
<?php 
    $servername = "localhost";
    $username = "dasusername";
    $password = "daspassword";
    $dbname = "notadummy";
    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    } 
    $result = mysql_query("SELECT userid FROM vms_users");
    $data = array();
    while(($row = mysql_fetch_array($result))) {
        $data[] = $row['userid'];
    }
    print_r(array_values($data));
    $conn->close();
?>
 
     
     
    