dtmsaqtly798322992 2012-11-12 19:12
浏览 10

试图呼应新线路并且无法正常工作[重复]

Possible Duplicate:
PHP: trying to create a new line with “ ”
line break help in PHP

Hello I have been trying to echo to a new line in PHP using the thing and it just isn't working, I have tried separating it just in case PHP got confused or something and it still isn't working, HELP!!

This is my code, you shouldn't need to know it all:

Take "id" to be 1, "sender" to be "test" and "message" to be "test"

echo($rows."
");

while($rowarray = mysql_fetch_array($result)){

echo($rowarray["id"].") From: ".$rowarray["sender"]." - ".$rowarray["message"]."
");

}

I want it to print out like this:

1 (or how many rows there are)
1) From: test - test

I have no idea what I am doing wrong. I would really appreciate help

  • 写回答

1条回答 默认 最新

  • douju1953 2012-11-12 19:14
    关注

    If you're viewing this output in the browser, try adding a break tag instead of a newline.

    echo($rows."<br />");
    
    while($rowarray = mysql_fetch_array($result)){
        echo($rowarray["id"].") From: ".$rowarray["sender"]." - ".$rowarray["message"]."<br />");
    }
    

    I'll also add that the mysql* extension is being deprecated, you should use mysqli or PDO instead.

    评论

报告相同问题?