Page 1 of 1

strange behavior help please

Posted: Fri Oct 23, 2009 12:52 pm
by xtzman
The page after the php code doesnt appear, just the list created by the php.
help please.
sorry about mi english.





Code: Select all

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
 
<h1>
  <?php require_once('Connections/BO_Geral.php'); ?>
 
 
<br />
THIS APPEAR AS NORMAL, its ok here  <br />
<br />
 
 
 
 
 <?php
          
$sqla="SELECT DISTINCT `agrupamento` , `pagina` FROM `conteudo` ORDER BY `pagina` , `agrupamento` ASC";
 
$lista = mysql_query($sqla);
$flagi="";
 
while ($row=mysql_fetch_array($lista) or die (mysql_error()))
{
    if ($flagi!=$row['pagina']){        
        echo $row['pagina'];
        echo "<br/>";
        $flagi=$row['pagina'];}
    
    echo '<a href="BO_Content_List.php?agr='.$row['agrupamento'].'&pag='.$row['pagina'].'">'.$row['agrupamento'].'</a>';
    echo "<br/>";
    
}
?>
 
<br />
<br />
THIS TEXT DOESNT APPEAR...NOTHING HAPENS  <br />
<br />
</h1>
</body>
</html>

Re: strange behavior help please

Posted: Fri Oct 23, 2009 1:16 pm
by califdon
I cannot see any reason that the last part of the HTML doesn't appear. It looks correct to me. It seems unusual to me that you include so much, even all your PHP output, within an <h1> ... </h1> element. Could you perhaps be exceeding some HTML limit for that tag element?

Your English is not a problem. It is certainly better than if I tried to write in your language. :-)

Re: strange behavior help please

Posted: Fri Oct 23, 2009 1:27 pm
by Mirge
What about line 25? Is that query working or failing? Check it... could be an issue.

Re: strange behavior help please

Posted: Fri Oct 23, 2009 1:30 pm
by xtzman
the query works, because it makes the list i want...its after the END of the while function that everithing stops...

i think the problem may be the while function...maybe it enters in a infinite loop by some strange reason.
please someone try this to see if its a php bug.

or please advise me about some diferent way to do this!

here is the table i use:

table "conteudo"
id,pagina,agrupamento
1,page1,fotos
2,page1,fotos
3,page2,texto
4,page1,fotos
5,page2,texto
6,page1,grafico
7,page2,texto
8,page2,fotos
9,page3,grafico

and i need to make a list like this:

page1
fotos
grafico
texto
page2
fotos
texto
page3
grafico

Re: strange behavior help please

Posted: Fri Oct 23, 2009 1:48 pm
by califdon
Oh, I think you found the problem, yourself! The use of "or die()" within the while loop condition means that the condition will always be true, because even when there are no more rows to fetch, the die() function will still return True! Remove the "or die()". You can check for any error on the first line inside the loop, but don't do it inside the condition for the loop.