Actually that was a very good first attempt (nearly nailed it!).

First, on your download.php
PHP Code:
header("Content-disposition: attachment; filename= $blob"); 
This line $blob should be the name of the file being requested (more on that later).

Currently, you are calling download.php, but you are not providing the file that needs to be downloaded. Change it to this:
HTML Code:
                       <li><?php echo $row['name']; ?></li> 
                     <a href="download.php?name=<?php echo urlencode($row['name']); ?>"> Download file</a>
Then in your download.php you need to read that filename to use in your query (place this above your query).
PHP Code:
$nameOfFile urldecode($_GET['name']); 
Then update your query to use the new variable
PHP Code:
$filequery("SELECT * FROM files where studentid= ? AND name = ?"$_SESSION['id'], $nameOfFile); 
Last, use that same variable for the filename=
PHP Code:
header("Content-disposition: attachment; filename=$nameOfFile");