显示数据库中的所有数据行

I am developing a document management system, so far I'm able to log in and upload documents based on the user that's logged in. I've also managed to construct the code so it captures the records assigned to that user and display them in a table. So I am able to log in as different users and see what I've uploaded as them users individually. However, the only problem is that the script is only pulling out one row of data for each users, when there are multiple instances in the database. See the code below:

<!-- start of php code to query and display documents -->
        <?php
        $sql = mysqli_query($conn, "SELECT upload.personalid, upload.file, upload.type, upload.size, person.personalid FROM upload inner join person on upload.personalid=person.personalid where person.username='$uname '") or die (mysqli_error($conn));
        $filedata= ($sql) ? mysqli_fetch_array($sql) : false;    
        {   
            if($filedata){
        ?>
            <tr>
                <td><?php echo $filedata['file'] ?></td>
                <td><?php echo $filedata['type'] ?></td>
                <td><?php echo $filedata['size'] ?> Bytes</td>
            </tr>
        <?php
            }
        else {
            echo 'No files found';
        }
        }
        ?>
<!-- end of php code to query and display documents -->

This all works fine, I just want it to display all the rows of data assigned to the logged in user, instead of one. How do I do this?

Thanks,

Sohail.

You can change it so that you loop through each returned record like this:

<?php
$sql = mysqli_query($conn, "SELECT upload.personalid, upload.file, upload.type, upload.size, person.personalid FROM upload inner join person on upload.personalid=person.personalid where person.username='$uname '") or die (mysqli_error($conn));
if (mysqli_num_rows($sql) > 0) {
    while ($filedata = mysqli_fetch_array($sql)) {
    ?>
        <tr>
            <td><?php echo $filedata['file']; ?></td>
            <td><?php echo $filedata['type']; ?></td>
            <td><?php echo $filedata['size']; ?> Bytes</td>
        </tr>
    <?php
    }
} else {
    echo 'No files found';
}
?>

You're close. You need a while loop. Replace

 $filedata= ($sql) ? mysqli_fetch_array($sql) : false; 
 if($filedata){

With

while($filedata = mysqli_fetch_array($sql)) {