title: Downloading data to a csv file from MySQL using PHP
body: <p>How do I specify the file to be downloaded from the database?</p>
  
  <p>main.php:</p>
  
  <pre><code>    include('databaseConnection.php');
  
      $result = mysql_query("SELECT * FROM participants");
  
      while($row = mysql_fetch_array($result)){
  
  
  $download_me= $row['cv'];
  
  echo $row['name'] . " " . $row['area_of_exp'] . " " ;
  
  echo "&lt;a href='download.php?file=$download_me'&gt; cv &lt;/a&gt;";
  
  echo "&lt;br /&gt;";
    }
  </code></pre>
  
  <p>download.php (which is where the problem lies):</p>
  
  <pre><code>$file = $_GET['row["cv"]'];  
  header('Content-Disposition: attachment; filename="'.$file.'"');
  echo $file;
  </code></pre>
  
  <p>I want the CV to be downloaded when the link in main.php is clicked</p>