i think your problem is that you are not returning a value in your function.
your function should be able to return a value. It looks like this:
function getsubact ($snam) {
$query = "SELECT files.id, files.snam, files.acct, files.doc_date, files.flag, files.file, files.rep_id, files.mgr_id, files.lname, files.mkval, files.dir FROM files WHERE files.snam = '$snam' ";
return $query; //return the $query string to whatever called this function. :)
}
you must realize that this function will return this string:
SELECT files.id, files.snam, files.acct, files.doc_date, files.flag, files.file, files.rep_id, files.mgr_id, files.lname, files.mkval, files.dir FROM files WHERE files.snam = '2'
since i'm not sure exactly what you are doing, besides trying to get all the record if a user click on a link, i can't help you further. But i will honestly say, you are most likely heading in the wrong direction.
i'm thinking something like this:
if($value =="yes"){
//show link with all values
// <a href='list_all.php'>List all</a>
// here you just use the sql query that is in the function, i suppose
}
else {
// show regular link
}