Page 1 of 1

Doesn't make new lines

Posted: Wed May 24, 2006 1:20 pm
by NiGHTFiRE
Hey.
This is my code:

Code: Select all

<?php
$sql = "SELECT COUNT(id) FROM auction where status='ny'";
$result = mysql_query($sql) or die(mysql_error());
//$limit = 3; // Antal "nya" nyheter
$row = mysql_fetch_array($result); 
$numrows = mysql_result($result, 0); // antal i databasen 
if (mysql_result ($result , 0) <= 0)
{
print '<br>Finns inga auction ännu!<br>';
}
else
{
$result = mysql_query("SELECT * FROM auction where status='ny' ORDER BY id DESC LIMIT 1");
$row = mysql_fetch_array($result);
$text = "Denna auktion startades:". $row['datum_borja'];
print "\n";
$text .= "Auktionens namn är:". $row['auktionnamn'];
print "\n";
$text .= "Det kan vara totallt". $row['maxantalbud'];
$text .= " bud";
print "\n";
$text .= $row['info'];
print text_replace($text);
}
?>
But it doesn't make new lines where it is print "\n";
I've tryed with print "<br>"; and echo "\n"; and echo "\n"; but nothing works. Why?

Thanks

Posted: Wed May 24, 2006 1:23 pm
by PrObLeM
im assuming that you know that \n makes a newline if you view the source and <br/> makes a newline when you view the page. Right?

Posted: Wed May 24, 2006 1:36 pm
by NiGHTFiRE
I changed it to that now and i still got the same results : http://wmegn.mine.nu/emil/

It seems that it makes the <br/> but in the wrong place? or such

Posted: Wed May 24, 2006 1:38 pm
by Flamie
well obviously, you're printing 3 new lines with no text in between, then priting your text... was that intentional?
instead of print "\n" have text .= "<br/>";

Posted: Wed May 24, 2006 1:44 pm
by PrObLeM
Flamie wrote:well obviously, you're printing 3 new lines with no text in between, then priting your text... was that intentional?
instead of print "\n" have text .= "<br/>";
Oh my, I didn't even see that. That should solve your problem.

Posted: Wed May 24, 2006 1:52 pm
by NiGHTFiRE
Flamie: Thanks.
God damn what clumbsy misstakes I do knower days :P
Thanks again

EDIT: I also had to replace print text_replace($text); to print ($text);