export from server to local computer using PHP
<p>Hi I'm trying to export a file, usiing PHP , created through queries to a database in MySQL. It's driving me crazy. 
I add the code that doesn't work and I really appreciate in advance any help. </p>

<p>the code:</p>

<pre><code>$fp = fopen("THE_FILE.htm","w"); 

fwrite($fp, "Some stuff from the database NOT the whole database");

fclose($fp);

$file= 'THE_FILE.htm';

$link= '\localhost:8080\'.$file;  // When I'm testing in the localhost


if (is_file($link)){

    header('Content-Type: application/force-download');
    header('Content-Disposition: attachment; filename='.$file);
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: .filesize($link));
    readfile($link);}
    else
    enter code here



else
exit();
</code></pre>
