如何使用两个条件进行while循环

this is my first question here I want to display uploaded files , each one with its description.

$sql = "SELECT * FROM `tablename` WHERE id='$this->id' AND type='$this->type'
ORDER BY `pid` desc";

if ($query = mysqli_query($conn, $sql)) {
    echo 'Successful';
}else{  
    echo 'error';
}

$numrows = mysqli_num_rows($query);
if ($numrows > 0 ){  
    $dir = 'uploads/'.$this->id.'/videos';
    $handle = opendir($dir);
    while (false !== ($entry = readdir($handle)) && $row = mysqli_fetch_row($query)) 
    {
        if($entry !== "Thumbs.db" && $entry !== "." && $entry !== "..") { 
            echo "<tr><td></td><td><a target='new' href='".$dir."/$entry'>$entry</a><br>"
            . "<video width='320' height='240' controls><source src='".$dir."/$entry' type='video/mp4'></video></td><td>".$row['vid_desc']."</td></tr>";
        }
    }
    closedir($handle); 
}

it just prints "Successful" and no files or decriptions returned although I have 2 entries

Update:

the while loop works properly but it doesn't read what inside the folder, I removed the if statement inside the while loop and changed the $dir to other directories and it doesn't read any thing except (.) and (..) which refers to parent directories, although these new directories have ,at least, two files inside each of them.