Have a look at what you're asking the functions to do (first, by tidying up the indenting):
function flash()
{
if ($_GET['format'] == "flash")
{
$a = " AND format='flash'";
}
else
{
echo "";
return $a;
}
}
So when $_GET['format']=='flash', you set $a = "...", and return nothing, while when $_GET['format'] doesn't equal flash you output an empty string to the browser, and return $a ... which contains nothing. Either way, you return nothing.
(PS: the SQL syntax you've got in that third function is buggy.)