Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Newbie, spacing out an article....sorry!

    Hi Everyone,

    Ive been asked to try and convert our small website into PHP, im not a web developer but im going to give it a try

    Basically we have a news page, i can get all the text to print out onto the page its just theres no formating at all it comes out like this:

    转会合约丑闻之后,鲁尼在周六重返曼联,在下半场被替换上场。在周六的比赛中,曼联坐镇主场迎战来访的维冈,最终以2:0战胜维冈。 这个英格兰射手终于走出膝盖受伤的阴影重返曼联,加入曼联争夺英超和欧冠的阵营。 “我已经签了新合约,我未来的足球生涯是和曼联联系在一起的”鲁尼在重返赛场之后接受采访时说。 “周六赛场上的球迷真的非常让我感动。我离开了很长的时间,如果我说我一点都不担心球迷的反应,那绝对是骗人。看到他们对我的接纳我真的松了一口气,我会尽我所能帮助球队多进球” “我可以理解合约谈判对球迷们造成的影响。各大媒体的介入使得整个事件更加复杂,对球迷而言则更加难以接受。” “但是对我和球队来说,最重要的是我们最终达成了共识签订了合约。” 鲁尼还透露说他的队友们张开双臂欢迎他的回归,他会努力成为未来球队的支柱。 这位英格兰足球巨星还表示“我会像当年吉格斯,内维尔和斯科尔斯帮助我那样帮助年轻的球员。” “我想要留在曼联,尽我所能使俱乐部取得更多的胜利。我从始至终都是想要留在曼联的。” “我的确有自己的想法也表明了我的立场,但是不管怎么说我真的很高兴最终留在曼联。”
    I ideally need to add a break after each line in the text, ive searched around but dont really understand it all to be honest. This is the code im using to extract the article:

    PHP Code:
    <?php

    mysql_connect
    ("localhost""web148""123") or die(mysql_error());
    mysql_select_db("web148") or die(mysql_error());

    mysql_query("SET names 'utf8'");
    $result mysql_query("SELECT body FROM article WHERE ID='1'");

     
    $row mysql_fetch_array$result );
    echo 
    $row['body'];


    ?>
    If anyone could point me in the right direction id appreciate it

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,055
    Thanks
    10
    Thanked 94 Times in 92 Posts
    try
    PHP Code:
    <?
    echo nl2br($row['body']);
    ?>
    ?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • Users who have thanked firepages for this post:

    lane87 (12-17-2010)

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by firepages View Post
    try
    PHP Code:
    <?
    echo nl2br($row['body']);
    ?>
    ?
    Thank you worked perfectly.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •