Tema: ?id=$
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/07/2003, 16:39
Omega
 
Fecha de Ingreso: julio-2003
Mensajes: 22
Antigüedad: 20 años, 9 meses
Puntos: 0
suponendo ke tienes creado un sistema de noticias con php y MYSQL deberias crear una tabla como esta por ejemplo:

CREATE TABLE noticias (
id bigint(7) NOT NULL auto_increment,
autor varchar(100) NOT NULL,
titulo varchar(255) NOT NULL,
fecha varchar(100) NOT NULL,
noticia text NOT NULL,
KEY id (id))

y luego el siguiente codigo donde quieras que aparezca el enlace a la noticia:


$mostrar = 3;(enlaces a las noticias a mostrar)

$mysql_host = "localhost";
$mysql_user = "root";
$mysql_password = "";
$DBName = "ejemplo_es_db";


$conecta = mysql_connect($host,$user,$pass);
mysql_select_db($dbname,$conecta);

$query = "select * from noticias order by id desc";
$resp = mysql_query($query);
while ($datos = mysql_fetch_array($resp)) {
if ($mostrar > 0) {
echo "
<table>
<tr><td><b><a href='www.tuweb.com/noticias/noticia.php?id=$datos[id]'>$datos[titulo]</a></b></td></tr>
</table><br>
\n";
$mostrar--;
}
}

mysql_query($query);
mysql_close($conecta);



espero haberte podido ayudar

Última edición por Omega; 24/07/2003 a las 16:42