tengo el siguiente codigo, pero no me sale el enlace de exportar, porfa un ayuda
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
:
Código PHP:
<?php
$db = odbc_connect('base','','');
if (!$db) {
exit('Error en la conexión a la base de datos');
} else {
$consulta = "SELECT *FROM Fichas WHERE ((Fichas.Clasificacion)>='150' And (Fichas.Clasificacion)<='199.99')";
$result = odbc_exec($db,$consulta);
if (!$result) {
exit("Error en la consulta");
} else {
if( ! empty($_GET['exportar']) )
{
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;filename=nombredelarchivoagenerar.xls");
}
echo'.(empty($_GET['exportar'])?'<a href="Psicologia.php?exportar=1">Exportar</a>':'').';
echo "<table border=\'1\' align='center' width=\"750\">\n <tr bgcolor='#669933'>
<th id='etiqueta1' style='font-size:13px'>Fecha</th>\n <th id='etiqueta1' style='font-size:13px'>Titulo</th>\n <th id='etiqueta1' style='font-size:13px'>Autor</th>\n <th id='etiqueta1' style='font-size:13px'>ISBN</th>\n <th id='etiqueta1' style='font-size:13px'>Clasificacion</th>\n <th id='etiqueta1' style='font-size:13px'>Año</th>\n </tr>\n";
while($valor = odbc_fetch_array($result))
{
$Fecha = $valor['Fecha'];
$Titulo = $valor['Titulo'];
if(!$valor['Autor']){
$Autor = ('NA');
}else{
$Autor = $valor['Autor'];
}
if(!$valor['ISBN']){
$ISBN = ('NI');
}else{
$ISBN = $valor['ISBN'];
}
$Clasificacion = $valor['Clasificacion'];
$cadena=$valor['DatosFijos'];
$cadena_original = substr ($cadena, 6);
$longitud_cadena_original = strlen ($cadena_original);
$resto = $longitud_cadena_original -22;
$cadena_original = substr ($cadena, 6, $resto);
print " <tr>\n <td width=\"115\" align='center' id='etiqueta' style='font-size:12px'>$Fecha</td>\n <td width=\"200\" align='center'id='etiqueta' style='font-size:12px'>$Titulo</td>\n <td width=\"150\" align='center'id='etiqueta' style='font-size:12px'>$Autor</td>\n <td width=\"115\" align='center'id='etiqueta' style='font-size:12px'>$ISBN</td>\n <td width=\"115\" align='center'id='etiqueta' style='font-size:10px'>$Clasificacion</td>\n <td width=\"60\" align='center'id='etiqueta' style='font-size:12px'>$cadena_original</td>\n </tr>\n";
}
odbc_close($db);
echo '</table><br><br>\n';
}
}
?>