链接下载不起作用[关闭]

When I click on a link, I can't download the image, only visualize it. What is my mistake?

PHP:

  require('conecta.php');
  ini_set('display_errors',1); error_reporting(E_ALL);  
    $cSQL="SELECT ID_PIC, PIC, NOMBRE FROM FOTOS";
    $stmt=$oConni->prepare($cSQL) or die($oConni->error);
    $stmt->execute(); 
    $stmt->store_result();
    $stmt->bind_result($id, $pic, $nombre);
    //$i=0;
    echo '<table cellspacing="0">';
    while ($stmt->fetch()) {

        if (!empty($pic)){ 
            echo'<tr><td><img class="sifoto" src="images.php? id='.$id.'" width="100" height="100"  /></td></tr>';
        }
        echo'<tr><td value='.$id.'><a href='.$nombre.'>DOWNLOAD</a></td></tr>'; 
        //$i++;
    }   
    $stmt->close();
    echo'</table>';

 ?>

Thgis question is similar to another. Please check here - Force file download with php using header()

You need to set the headers for a file transfer.

As @WesleySchleumer said, you need to add quotes to the download link. change:

echo'<tr><td value='.$id.'>DOWNLOAD<a href='.$nombre.'></a></td></tr>';

to:

echo'<tr><td value='.$id.'><a href="'.$nombre.'">DOWNLOAD</a></td></tr>';