PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
NiGHTFiRE
Forum Contributor
Posts: 156 Joined: Sun May 14, 2006 10:36 am
Location: Sweden
Post
by NiGHTFiRE » Wed May 24, 2006 1:20 pm
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
PrObLeM
Forum Contributor
Posts: 418 Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:
Post
by PrObLeM » Wed May 24, 2006 1:23 pm
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?
NiGHTFiRE
Forum Contributor
Posts: 156 Joined: Sun May 14, 2006 10:36 am
Location: Sweden
Post
by NiGHTFiRE » Wed May 24, 2006 1:36 pm
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
Flamie
Forum Contributor
Posts: 166 Joined: Mon Mar 01, 2004 3:19 pm
Post
by Flamie » Wed May 24, 2006 1:38 pm
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/>";
PrObLeM
Forum Contributor
Posts: 418 Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:
Post
by PrObLeM » Wed May 24, 2006 1:44 pm
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.
NiGHTFiRE
Forum Contributor
Posts: 156 Joined: Sun May 14, 2006 10:36 am
Location: Sweden
Post
by NiGHTFiRE » Wed May 24, 2006 1:52 pm
Flamie: Thanks.
God damn what clumbsy misstakes I do knower days
Thanks again
EDIT: I also had to replace print text_replace($text); to print ($text);