Jump to content

Some problems..


Kristian_C

Recommended Posts

Hey ppl have a little problem with a site that wont appear, the code is :

		<?$ny="SELECT * FROM nyheter WHERE id!='0' ORDER BY tid DESC";$nyheter=mysql_fetch_object(mysql_query($ny));while($nny=mysql_num_rows(mysql_query($ny))){?><div class="news-header"><strong>Tittel : <? echo"$nyheter->tittel"; ?> <br>		Skrevet av : <? echo"$nyheter->brukernavn"; ?> <br>		Skrevet den : <? echo"$nyheter->tid"; ?></strong></div><div class="news-content"><? echo"".bbcode($nyheter->tekst).""; ?></div>		<?}?>

The site appears when i make erros in the scrips like removes a } or {, but when i have it like it is now the site is just loading, is there anything wrong with the code? :s..-Kristian_C

Link to comment
Share on other sites

while($nny=mysql_num_rows(mysql_query($ny))){

This line is causing the while loop to run indefinitely, as the number of rows in your query is a fixed value, and so will just continue to be assigned to $nny over and over again...I think you meant it to be like

<?$ny=mysql_query("SELECT * FROM nyheter WHERE id!='0' ORDER BY tid DESC");while($nyheter=mysql_fetch_object($ny)) {?>

Link to comment
Share on other sites

Ahha, thanks mate, but iv'e allways used like

$something = "SELECT * FROM something WHERE something='something'";$somethingi = mysql_fetch_object(mysql_query($something));while($somethings = mysql_num_rows(mysql_query($something))){

iv'e may have done it abit different now but it should work the same as before... frustrating things :)...---But thanks again :)-Kristian_C

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...