Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/10/2010, 09:03
leoalvis
 
Fecha de Ingreso: febrero-2007
Mensajes: 43
Antigüedad: 17 años, 2 meses
Puntos: 0
Respuesta: Consulta sql no me funciona

buenos dias

este es el codigo del archivo donde esta el link para visualizar el id:

<?php
require_once("conexion.php");
//llamar a los registros de la tabla noticias

$sql="select * from noticias order by id_noticia desc";
$res=mysql_query($sql,$con);
?>

<html>
<head>
</head>
<body>
<table align="center" width="500">
<tr>
<td align="center" valign="top" width="500" colspan="5">
<h3>noticias de mi web</h3>
</td>
</tr>
<tr style="background-color:#666666; color:#ffffff; font-weight:bold">
<td align="center" valign="top" width="150">
Nombre
</td>
<td width="250" align="center" valign="top">
Detalle
</td>
<td width="50" align="center" valign="top">
fecha
</td>
<td width="50" align="center" valign="top">
hora
</td>
<td width="50" align="center" valign="top">

</td>
</tr>

<?php
while ($reg=mysql_fetch_array($res)){

?>
<tr style="background-color:#f0f0f0">
<td align="center" valign="top" width="150">
<?php echo $reg["titulo"]; ?>
</td>
<td width="250" align="center" valign="top">
<?php echo $reg["detalle"]; ?>
</td>
<td width="50" align="center" valign="top">
<?php echo $reg["fecha"]; ?>
</td>
<td width="50" align="center" valign="top">
<?php echo $reg["hora"]; ?>
</td>
<td width="50" align="center" valign="top">
<a href="detalle.php?id_noticia <?php echo $reg["id_noticia"]; ?>" title="Detalle de <?php echo $reg["titulo"]; ?>">
<img src="images/lupa.gif" width="24" height="24" border="0">
</a>
</td>
</tr>
<?php
}
?>
</table>
</body>
</html>


intenté con esta instruccion $sql="select * from noticias where id_noticia='".print_r($_GET["id_noticia"])."' ";.... algo positivo es que ya me
aparece este resultado en el navegador...

Notice: Undefined index: id_noticia in C:\wamp\www\cursophp\vid 9\detalle.php on line 3
select * from noticias where id_noticia='1' ... pero me sigue apareciendo el mismo error... agradezco nuevamente la ayudita...