Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/09/2004, 17:14
NRLABS
 
Fecha de Ingreso: febrero-2002
Ubicación: Chile
Mensajes: 1.573
Antigüedad: 22 años, 2 meses
Puntos: 2
Pues ID_Atomoticia e ID_Noticia son iguales, (si Atomoticia = 4, debo mostrar noticia 4)

Yo agrego datos desde un formulario (Ej, titulo en la tabla "atomoticia" y el texto en "noticias") ---lo hago asi, pues pq me dieron la db y yo tengo a hacer los php--

se me ocurrio hacer algo, que sirvio en cierta medida.

Código PHP:
<?php


include("conexion.php");
Conectarse();

$query mysql_query("SELECT * FROM noticias,atomoticias ORDER BY ID_Noticia,ID_Atomoticia DESC LIMIT 20");
while(
$row=mysql_fetch_array($query)){

$ID_Noticia $row[ID_Noticia];
$Texto $row[Texto];
$resto substr("$Texto"0200);

$ID_Usuario $row[ID_Usuario];
$ID_Atomoticia $row[ID_Atomoticia];
$Fecha $row[Fecha];
$Titulo $row[Titulo]; 

?>

  noticias <br>
ID_Noticia  --------- <? echo $ID_Noticia?><br>
Texto breve --------- <?php echo wordwrap($resto,100,"<br>",1);?><br>
Text----------------- <? echo $Texto?><br>


atomoticias<br>

ID_Atomoticia-------- <? echo $ID_Atomoticia?><br>
Titulo -------------- <? echo $Titulo?> <br>
ID_Usuario ---------- <? echo $ID_Usuario?><br>
Fecha---------------- <? echo $Fecha?><br>
ID_IPv6 ???<p><p>
<?php  }

mysql_free_result($query); ?>

pero al ejecutar me duevelve:

noticias
ID_Noticia --------- 1
Texto breve --------- texto
Text----------------- texto
atomoticias
ID_Atomoticia-------- 2
Titulo -------------- titulo2
ID_Usuario ---------- 3
Fecha---------------- 2004-09-18 16:58:56
ID_IPv6 ???

noticias
ID_Noticia --------- 1
Texto breve --------- texto
Text----------------- texto
atomoticias
ID_Atomoticia-------- 1
Titulo -------------- titulo
ID_Usuario ---------- 3
Fecha---------------- 2004-09-18 16:58:13
ID_IPv6 ???


noticias
ID_Noticia --------- 2
Texto breve --------- texto2
Text----------------- texto2
atomoticias
ID_Atomoticia-------- 2
Titulo -------------- titulo2
ID_Usuario ---------- 3
Fecha---------------- 2004-09-18 16:58:56
ID_IPv6 ???


noticias
ID_Noticia --------- 2
Texto breve --------- texto2
Text----------------- texto2
atomoticias
ID_Atomoticia-------- 1
Titulo -------------- titulo
ID_Usuario ---------- 3
Fecha---------------- 2004-09-18 16:58:13
ID_IPv6 ???



..................



Me lo repite...
Sigo buscando..

Gracias