Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/09/2009, 09:04
elexavi
 
Fecha de Ingreso: enero-2007
Mensajes: 47
Antigüedad: 17 años, 3 meses
Puntos: 0
Cita:
Iniciado por KrowMx Ver Mensaje
Si te refieres a recorrer los 2 query hasta que no exista nada, una solución puede ser utilizar && AND en el while

while(($line = mysql_fetch_assoc($results) && ($line1 = mysql_fetch_assoc($results1)) {
echo "<noticia>";
echo "<titulo>" . $line["post_title"] . "</titulo>\n";
echo "<mensaje>" . $line["post_excerpt"] . "</mensaje>\n";
echo "<fecha>" . $line["post_date"] . "</fecha>\n";
echo "<imagen>" . $line["imagepath"] . "</imagen>\n";
echo "</noticia>\n";
}

Saludos
Lo he hecho como me dices pero me arroja en blanco la pagina

Código PHP:

$query = 'SELECT * FROM ex_posts WHERE post_type="post" AND post_status="publish" ORDER BY ID DESC';
$results = mysql_query($query);
$query1 = 'SELECT * FROM ex_awsompxgimagecaptions ORDER BY capid DESC';
$results1 = mysql_query($query1);


echo "<?xml version="1.0\" encoding=\"utf-8\"?>\n";
echo 
"<new>\n";

while((
$line mysql_fetch_assoc($results) && ($line1 mysql_fetch_assoc($results1)) {
        echo 
"<noticia>";
        echo 
"<titulo>" $line["post_title"] . "</titulo>\n";
        echo 
"<mensaje>" $line["post_excerpt"] . "</mensaje>\n";
        echo 
"<fecha>" $line["post_date"] . "</fecha>\n";
        echo 
"<imagen>" $line1["imagepath"] . "</imagen>\n";
        echo 
"</noticia>\n";
}
echo 
"</new>\n";

mysql_close($link);

?>
Código:
while(($line = mysql_fetch_assoc($results)) && ($line1 = mysql_fetch_assoc($results1))) {
		echo "<noticia>";
		echo "<titulo>" . $line["post_title"] . "</titulo>\n";
		echo "<mensaje>" . $line["post_excerpt"] . "</mensaje>\n";
		echo "<fecha>" . $line["post_date"] . "</fecha>\n";
		echo "<imagen>" . $line1["imagepath"] . "</imagen>\n";
		echo "</noticia>\n";
}
Perdon ya esta era cuestion de parentesis faltaba alguno, ahora si me va bien GRACIAS!!!!!!!

Última edición por GatorV; 17/09/2009 a las 13:21