Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/12/2004, 11:33
Avatar de camargo
camargo
 
Fecha de Ingreso: abril-2002
Ubicación: Kerétaro, Méjiko
Mensajes: 1.045
Antigüedad: 22 años, 1 mes
Puntos: 2
Primero q nada debes tener la tabla MYSQL de las noticias

CREATE TABLE noticias (
id int(9) NOT NULL auto_increment,
noticia longtext NOT NULL default '',
imagen char(50) NOT NULL default '',
PRIMARY KEY (`id`)
)

en el campo noticia tienes "X" ... y
en el campo imagen tienes por ejemplo:

http://chorcha.com/logo.gif

INSERT INTO noticias VALUES (1, 'x noticia', 'http://www.chorcha.com/logo.gif');


Código PHP:
<?

$sql 
mysql_query("SELECT * FROM noticias"); //CONSULTA (QUERY a la BD)
$row=mysql_fetch_array($sql)){

echo 
"".$row['noticia']."<br>
<img src=\""
.$row['imagen']."\" border=0>"//OBTENEMOS LA NOTICIA y su IMAGEN

}

//ceramos

?>


muy sencillo, en 2 min se hace ;)
__________________
http://www.chorcha.com

Última edición por camargo; 04/12/2004 a las 11:35