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.

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制