Comunidad de diseño web y desarrollo en internet online

Ayuda Para ordenar noticias por id

Citar            
MensajeEscrito el 03 Ago 2009 01:12 am
bueno mi problema es este estoy haciendo esta web www.rap809.com/index.php
entonces la tengo dividida bueno he echo una imegen para explicarme mejor

Aqui esta la direccioon de la imgen.
http://www.rap809.com/noticias.jpg



yo tube que hacer dos tablas para poner las notias arriba y abajo :shock: pero eso me perder mucho tiempo tener que insertar la noticia en la tabla luego borrarla e insertar la noticia en la otra tabla y luego poner la nueva noticia en la tabla de arriba :shock: porfavor espero que puedan ayudarme. Gracias

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 01:46 am
útiliza order by en la consulta SQL que estés haciendo.

Código PHP :

$sql = "select * from tabla_noticias where id='$ID' order by id desc";
$query = mysql_query($sql);


Order by se encarga de ordenar los resultados de la consulta.

Por ivanfc0o

Claber

391 de clabLevel

3 tutoriales

Genero:Masculino  

Hardcore UI

firefox
Citar            
MensajeEscrito el 03 Ago 2009 02:40 am
NO entiendo muy bien que debo aser con el codigo para que baje de una tabla a otra ... :(

PD:Soy un poco nuevo

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 03:28 am
Explicaté un poco más, pon un poco de código que tengas o algo. ¿Cuando dices tablas te refieres a tablas de la base de datos o HTML?

Por ivanfc0o

Claber

391 de clabLevel

3 tutoriales

Genero:Masculino  

Hardcore UI

firefox
Citar            
MensajeEscrito el 03 Ago 2009 12:44 pm
html
porque las bases de datos ya las tengo ordenasdas por id descendente 23, 22, 21... pero lo que quiero es que la 23 se quede ariba y baje 22 y las demas a la otra tabla "html" y luego que ponga la noticia 24 la 23 baje a la otra tabla y la 24 se queda arriba.Gracias

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 02:51 pm
pero si se puede aser que baje a la otra bd tanbien me interesaria.

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 03:49 pm
A lo que se refieren es como haces para obtener los datos en el listado de las noticias, si el listado se hace automaticamente (o sea que la tabla HTML que usas se genera por si sola), basta que en la consulta SQL aumentes la sentencia ORDER BY.
Postea la parte del código en la que muestras la noticia.
Saludos.

Por -george-

58 de clabLevel



 

Tartarus

firefox
Citar            
MensajeEscrito el 03 Ago 2009 03:50 pm

luisjavier2008 escribió:

pero si se puede aser que baje a la otra bd tanbien me interesaria.
:shock:

Perdon A otra bd no a otra tabla!

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 04:02 pm
Esa Es la tabla de arriba

Código PHP :

<table width="621" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="left" valign="bottom"><div class="titulo"><strong><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>"><?php echo $row_inicio['titulo']; ?></a></strong></div>
                        <div><strong>A&ntilde;adido por:</strong> <?php echo $row_inicio['autor']; ?>-<strong> Fecha:</strong>                          <?php echo $row_inicio['fecha']; ?>
                          <table border="0" align="left" cellpadding="0" cellspacing="10">
                            <tr>
                              <td width="64"><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>"><?php echo $row_inicio['imagen']; ?></a></td>
                            </tr>
                          </table>
                          <div class="letra Estilo5">
                            <div align="left">
                              <p><?php echo $row_inicio['contenido']; ?></p>
                              </div>
                          </div>
                          <p class="Estilo5"><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>" class="Estilo10">LEER MAS&hellip;</a></p>
                          <p align="right" class="Estilo5"><img src="imagenes/musica-anivel.jpg" alt="musica anivel" width="290" height="89" /></p>
                        </div></td>
                  </tr>
              </table>


Esta es la otra tabla

Código PHP :

<table width="621" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td align="left" valign="bottom"><div class="titulo"><strong><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>"><?php echo $row_inicio2['titulo']; ?></a></strong></div>
                            <div><strong>A&ntilde;adido por:</strong><?php echo $row_inicio2['autor']; ?> - <strong>Fecha:</strong> 
                              <?php echo $row_inicio2['fecha']; ?>
                              <table border="0" align="left" cellpadding="0" cellspacing="10">
                                <tr>
                                  <td width="64"><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>"><?php echo $row_inicio2['imagen']; ?></a></td>
                                </tr>
                                </table>
                              <p>&nbsp;</p>
                              <div class="letra Estilo5"><?php echo $row_inicio2['contenido']; ?></div>
                              <p class="Estilo5"><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>" class="Estilo10">LEER MAS&hellip;</a></p>
                            </div></td>
                      </tr>
                    </table>

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 04:07 pm
Bueno aca dejo el index completo

Código PHP :

<?php require_once('Connections/rap809.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

mysql_select_db($database_rap809, $rap809);
$query_inicio = "SELECT * FROM inicio ORDER BY id DESC";
$inicio = mysql_query($query_inicio, $rap809) or die(mysql_error());
$row_inicio = mysql_fetch_assoc($inicio);
$totalRows_inicio = mysql_num_rows($inicio);

$maxRows_inicio2 = 19;
$pageNum_inicio2 = 0;
if (isset($_GET['pageNum_inicio2'])) {
  $pageNum_inicio2 = $_GET['pageNum_inicio2'];
}
$startRow_inicio2 = $pageNum_inicio2 * $maxRows_inicio2;

mysql_select_db($database_rap809, $rap809);
$query_inicio2 = "SELECT * FROM inicio2 ORDER BY id DESC";
$query_limit_inicio2 = sprintf("%s LIMIT %d, %d", $query_inicio2, $startRow_inicio2, $maxRows_inicio2);
$inicio2 = mysql_query($query_limit_inicio2, $rap809) or die(mysql_error());
$row_inicio2 = mysql_fetch_assoc($inicio2);

if (isset($_GET['totalRows_inicio2'])) {
  $totalRows_inicio2 = $_GET['totalRows_inicio2'];
} else {
  $all_inicio2 = mysql_query($query_inicio2);
  $totalRows_inicio2 = mysql_num_rows($all_inicio2);
}
$totalPages_inicio2 = ceil($totalRows_inicio2/$maxRows_inicio2)-1;

mysql_select_db($database_rap809, $rap809);
$query_videosem = "SELECT * FROM videosem";
$videosem = mysql_query($query_videosem, $rap809) or die(mysql_error());
$row_videosem = mysql_fetch_assoc($videosem);
$totalRows_videosem = mysql_num_rows($videosem);

mysql_select_db($database_rap809, $rap809);
$query_chat = "SELECT * FROM chat";
$chat = mysql_query($query_chat, $rap809) or die(mysql_error());
$row_chat = mysql_fetch_assoc($chat);
$totalRows_chat = mysql_num_rows($chat);

mysql_select_db($database_rap809, $rap809);
$query_publicidad = "SELECT * FROM publicidad";
$publicidad = mysql_query($query_publicidad, $rap809) or die(mysql_error());
$row_publicidad = mysql_fetch_assoc($publicidad);
$totalRows_publicidad = mysql_num_rows($publicidad);

mysql_select_db($database_rap809, $rap809);
$query_radioo = "SELECT * FROM radio";
$radioo = mysql_query($query_radioo, $rap809) or die(mysql_error());
$row_radioo = mysql_fetch_assoc($radioo);
$totalRows_radioo = mysql_num_rows($radioo);

mysql_select_db($database_rap809, $rap809);
$query_artistavip = "SELECT * FROM artistavip";
$artistavip = mysql_query($query_artistavip, $rap809) or die(mysql_error());
$row_artistavip = mysql_fetch_assoc($artistavip);
$totalRows_artistavip = mysql_num_rows($artistavip);

$queryString_inicio2 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_inicio2") == false && 
        stristr($param, "totalRows_inicio2") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_inicio2 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_inicio2 = sprintf("&totalRows_inicio2=%d%s", $totalRows_inicio2, $queryString_inicio2);
?><?php  
include "config.php"; 
require "conexion.php"; 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="imagenes/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rap809</title>
<link href="css.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/interface.js"></script>
<link href="style.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.Estilo5 {font-size: 14px}
.Estilo10 {color: #FFCC00; font-size: 12px; }
.Estilo12 {
   color: #FFCC00;
   font-weight: bold;
   font-size: 12px;
}
.Estilo14 {color: #FFCF00; font-weight: bold; font-size: 12px; }
-->
</style>
</head>

<body>
<center>
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="imagenes/up-header.jpg" /></td>
  </tr>
  <tr>
    <td><img src="imagenes/logo.jpg" /></td>
  </tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="imagenes/menu1.jpg" /></td>
    <td bgcolor="#423C4A" class="menu"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><div align="center"><a href="index.php"><img src="imagenes/home.png" width="92" height="51" border="0" /></a></div></td>
        <td><div align="center"><a href="http://www.youtube.com/therap809"><img src="imagenes/videos.png" width="124" height="51" border="0" /></a></div></td>
        <td><div align="center"><a href="musica.php"><img src="imagenes/musica.png" width="128" height="51" border="0" /></a></div></td>
        <td><div align="center"><a href="contacto.php"><img src="imagenes/contactos.png" width="163" height="51" border="0" /></a></div></td>
        <td><div align="center"><a href="eventos.php"><img src="imagenes/eventos.png" width="134" height="51" border="0" /></a></div></td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
    <td><img src="imagenes/menu3.jpg" /></td>
  </tr>
  <tr>
    <td height="19" colspan="3" class="raya-up"></td>
    </tr>
</table>
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="6" class="raya-izquierda"></td>
    <td valign="top" bgcolor="#423C4A"><table border="0" cellspacing="8" cellpadding="0">
      <tr>
        <td width="641" valign="top" bgcolor="#FFFFFF" class="musica-anivel"><div align="center"><div align="center">
          <table width="641" border="0" cellpadding="0" cellspacing="10">
            <tr>
              <td><table width="621" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="left" valign="bottom"><div class="titulo"><strong><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>"><?php echo $row_inicio['titulo']; ?></a></strong></div>
                        <div><strong>A&ntilde;adido por:</strong> <?php echo $row_inicio['autor']; ?>-<strong> Fecha:</strong>                          <?php echo $row_inicio['fecha']; ?>
                          <table border="0" align="left" cellpadding="0" cellspacing="10">
                            <tr>
                              <td width="64"><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>"><?php echo $row_inicio['imagen']; ?></a></td>
                            </tr>
                          </table>
                          <div class="letra Estilo5">
                            <div align="left">
                              <p><?php echo $row_inicio['contenido']; ?></p>
                              </div>
                          </div>
                          <p class="Estilo5"><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>" class="Estilo10">LEER MAS&hellip;</a></p>
                          <p align="right" class="Estilo5"><img src="imagenes/musica-anivel.jpg" alt="musica anivel" width="290" height="89" /></p>
                        </div></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td align="left"><span class="Estilo14"><a href="resumen.php?id=<?php echo $row_inicio['id']; ?>#coment">Deja tus comentario </a></span></td>
            </tr>
          </table>
        </div></div></td>
        <td width="289" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td valign="top" bgcolor="#FFFFFF"><div align="center">
              <p><img src="imagenes/video-semana.jpg" width="248" height="35" /></p>
              <p><?php echo $row_videosem['contenido']; ?></p>
              <p><?php echo $row_videosem['titulo']; ?></p>
            </div></td>
          </tr>
          <tr>
            <td height="8" bgcolor="#423C4A"></td>
          </tr>
        </table><center>
                <p><img src="imagenes/radio_03.png" width="181" height="50" /></p>
                <p><?php echo $row_radioo['contenido']; ?></p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                </center>
          </td>
      </tr>
      <tr>
        <td valign="top" bgcolor="#FFFFFF"><p><div align="center">
            <?php do { ?>
              <table width="640" border="0" cellpadding="0" cellspacing="10">
                <tr>
                  <td><table width="621" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td align="left" valign="bottom"><div class="titulo"><strong><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>"><?php echo $row_inicio2['titulo']; ?></a></strong></div>
                            <div><strong>A&ntilde;adido por:</strong><?php echo $row_inicio2['autor']; ?> - <strong>Fecha:</strong> 
                              <?php echo $row_inicio2['fecha']; ?>
                              <table border="0" align="left" cellpadding="0" cellspacing="10">
                                <tr>
                                  <td width="64"><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>"><?php echo $row_inicio2['imagen']; ?></a></td>
                                </tr>
                                </table>
                              <p>&nbsp;</p>
                              <div class="letra Estilo5"><?php echo $row_inicio2['contenido']; ?></div>
                              <p class="Estilo5"><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>" class="Estilo10">LEER MAS&hellip;</a></p>
                            </div></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td align="left"><span class="Estilo12"><a href="resumen.php?id=<?php echo $row_inicio2['id']; ?>#coment">Deja tus comentario </a></span></td>
                </tr>
                    </table>
               <hr size="1" width="100%" align="left" color="#cccccc" noshade="noshade" />

              <?php } while ($row_inicio2 = mysql_fetch_assoc($inicio2)); ?></div>
           
          <div align="center">
            <table border="0" width="50%" align="center">
              <tr>
                <td width="23%" align="center"><?php if ($pageNum_inicio2 > 0) { // Show if not first page ?>
                      <strong><a href="<?php printf("%s?pageNum_inicio2=%d%s", $currentPage, 0, $queryString_inicio2); ?>">Primero</a>
                      <?php } // Show if not first page ?>
                  </strong> </td>
                <td width="31%" align="center"><?php if ($pageNum_inicio2 > 0) { // Show if not first page ?>
                    <a href="<?php printf("%s?pageNum_inicio2=%d%s", $currentPage, max(0, $pageNum_inicio2 - 1), $queryString_inicio2); ?>"><strong>Anterior</strong></a>
                    <?php } // Show if not first page ?>                </td>
                <td width="23%" align="center"><?php if ($pageNum_inicio2 < $totalPages_inicio2) { // Show if not last page ?>
                      <strong><a href="<?php printf("%s?pageNum_inicio2=%d%s", $currentPage, min($totalPages_inicio2, $pageNum_inicio2 + 1), $queryString_inicio2); ?>">Siguiente</a>
                      <?php } // Show if not last page ?>
                  </strong> </td>
                <td width="23%" align="center"><?php if ($pageNum_inicio2 < $totalPages_inicio2) { // Show if not last page ?>
                      <strong><a href="<?php printf("%s?pageNum_inicio2=%d%s", $currentPage, $totalPages_inicio2, $queryString_inicio2); ?>">&Uacute;ltimo</a>
                      <?php } // Show if not last page ?>
                  </strong> </td>
              </tr>
            </table>
          </div>
          <p>&nbsp;</p>
          <table border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2"><div class="dock" id="dock">
  <div class="dock-container"><a class="dock-item" href="#"><img src="images/home.png" alt="home" /><span>Home</span></a> 
  <a class="dock-item" href="#"><img src="images/email.png" alt="contact" /><span>Contact</span></a> 
  <a class="dock-item" href="#"><img src="images/portfolio.png" alt="portfolio" /><span>Portfolio</span></a> 
  <a class="dock-item" href="#"><img src="images/music.png" alt="music" /><span>Music</span></a> 
  <a class="dock-item" href="#"><img src="images/video.png" alt="video" /><span>Video</span></a> 
  <a class="dock-item" href="#"><img src="images/history.png" alt="history" /><span>History</span></a> 
  <a class="dock-item" href="#"><img src="images/calendar.png" alt="calendar" /><span>Calendar</span></a> 
  <a class="dock-item" href="#"><img src="images/rss.png" alt="rss" /><span>RSS</span></a></div>
</div>
<script type="text/javascript">
   
   $(document).ready(
      function()
      {
         $('#dock').Fisheye(
            {
               maxWidth: 60,
               items: 'a',
               itemsText: 'span',
               container: '.dock-container',
               itemWidth: 50,
               proximity: 90,
               halign : 'center'
            }
         )
      }
   );

</script>
&nbsp;</td>
              </tr>
          </table>          
          <p>&nbsp;</p></td>
        <td align="center" valign="top" bgcolor="#FFFFFF"><p><img src="imagenes/chat.jpg" width="105" height="38" /></p>
          <p><br>
            <?php echo $row_chat['contenido']; ?>
          
          <p><img src="imagenes/imágenes/rap809_03.png" width="181" height="50" /></p>
          <p><?php echo $row_publicidad['contenido']; ?></p>
          <p><img src="imagenes/artista-vip.jpg" width="193" height="47" /></p>
          <p><?php echo $row_artistavip['titulo']; ?></p>
          <p><?php echo $row_artistavip['contenido']; ?></p>
          <p><img src="imagenes/tonos.jpg" width="274" height="110" /></p>
        <!-------------anuncios Google---------------->
        <center><script type="text/javascript"><!--
google_ad_client = "pub-6868366017123280";
/* derecha 809 - 160x600 */
google_ad_slot = "2926367748";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
<!-------------anuncios Google---------------->
</td>
      </tr>
    </table></td>
    <td colspan="3" bgcolor="#423C4A"></td>
    <td class="raya-derecha"></td>
  </tr>
  <tr>
    <td height="6" colspan="6"><img src="imagenes/footer.jpg" /></td>
    </tr>
</table></td>
    </tr>
  </table>
</center>
</body>
</html>
<?php
mysql_free_result($inicio);

mysql_free_result($inicio2);

mysql_free_result($videosem);

mysql_free_result($chat);

mysql_free_result($publicidad);

mysql_free_result($radioo);

mysql_free_result($artistavip);

mysql_close($enlace); //siempre se cierra la conexion al final de la pagina ?> 

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 04:43 pm
Todo puede ir en una sola tabla, con que hagas una sola consulta utilizando order by como dice ivanfc0o esta bien. Ya que estas duplicando código y es poco optimo.
Cuando tengas todos los datos en una sola consulta obten cada registro con un bucle

Por psycho-vnz

Claber

1186 de clabLevel

7 tutoriales

Genero:Masculino  

safari
Citar            
MensajeEscrito el 03 Ago 2009 05:14 pm
Dios mio que rayos fue todo eso!!!

Esto:

Código PHP :

mysql_select_db($database_rap809, $rap809); 

puede ir una sola ves al inicio

Esto:

Código PHP :

mysql_num_rows($lo que sea!!);

Ponlo si lo vas a usar de resto no!

ahora como hacerlo:
creas la consulta la ejecutas como te dijo ivanfc0o

Código PHP :

$sql = "select * from tabla_noticias where id='$ID' order by id desc"; 
$query = mysql_query($sql);


luego recorres y haces la creacion segun los resultados que te bote el resulset asi:

Código PHP :

<table>
<?
while($datos = mysql_fetch_assoc($query)){
?>
<tr>
<td><?= $datos['bla1']?></td> <td><?= $datos['bla2']?></td> <td><?= $datos['bla3']?></td> <td><?= $datos['etc']?></td>
<tr>
<? }?>
</table>

Por jpcw

Claber

1715 de clabLevel

1 tutorial

Genero:Masculino  

AlgoritmicBrainDesigner

firefox
Citar            
MensajeEscrito el 03 Ago 2009 07:03 pm
Lo unico que logro con eso es que las noticias se pongan una debajo de otras como ya las tenia :( y no bjan a la otra tabla , poque no quiero hacerlo en una sola tabla, porque hice una divicion...

ayuda!!

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 07:06 pm
ahhh!! y otra cosa no me quiso funcionar

Código PHP :

$sql = "select * from tabla_noticias where id='$ID' order by id desc";  
$query = mysql_query($sql);


y luego tube que quitar ='$ID'

Código PHP :

$sql = "select * from tabla_noticias where id' order by id desc";  
$query = mysql_query($sql);


pero lo que quiero es que la noticia baje a la otra tabla

Por luisjavier2008

37 de clabLevel



 

firefox
Citar            
MensajeEscrito el 03 Ago 2009 07:49 pm
Aquí hay un error muy grande, No sabes lo que estás haciendo. No se trata de copiar y pegar, necesitas saber como funciona, te explicaré un poco pero también te recomiendo que leas tutoriales, más que nada sobre las conexiones a la base de datos y las consultas.

La consulta id='$ID' que removiste, muy probablemente no te funcionó por que no tenias definida la variable $ID es decir, esa variable no existe en tu script.

Puntos básicos a tomar en cuenta:

  1. Según entiendo, tienes 2 tablas en la base de datos para las noticias cuando 1 tabla sería suficiente.
  2. Estás útilizando los arrays directamente en tu html sin recorrer el resultado de la query por lo que sólo te mostrará la primera columna.


Sobre esto último, tienes que seleccionar las noticias que se mostrarán en el index, ejemplo:

Código PHP :

$sql = "select * from tabla_noticias order by id desc limit 0, 2"
$query = mysql_query($sql, $link);


Después de eso, recorres la consulta con un bucle como te lo dijo psycho-vnz y jpcw

Código PHP :

while($row = mysql_fetch_array($query))
{
   echo 'Titulo: ' . $row['titulo'];
   echo '<br />';
   // etc..
  /*
  Mostraria:
  Titulo de la noticia 1
  Titulo de la noticia 2
  */
}


Tomate el tiempo de leer un poco sobre lo que estás haciendo, entiendelo y así podrás adaptar los scripts a tus necesidades y, sobre todo, optimizarlo ya que como dice psycho-vnz, estás duplicando mucho código.

Saludos.

Por ivanfc0o

Claber

391 de clabLevel

3 tutoriales

Genero:Masculino  

Hardcore UI

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.