<?php
//after connecting etc..
$username = $_SESSION['username'];
$string = "SELECT msg FROM $table WHERE username='$username'";
$result = mysql_fetch_array(mysql_query($string)) or die(mysql_error());
echo $result[msg];
?>
Run Code Online (Sandbox Code Playgroud)
这是数据库的方式..
I wanted to install the database base.
I wanted to install the database server.
I wanted to install the Ubuntu.
Run Code Online (Sandbox Code Playgroud)
当我检索它们时,它们显示为..
I wanted to install the database base.I wanted to install the database server.I wanted to install the Ubuntu.
Run Code Online (Sandbox Code Playgroud)
它是一个TEXT字段..有没有办法让它们与新线一起出现?完全相同的?
非常感谢!
用这个:
echo nl2br($result[msg]);
Run Code Online (Sandbox Code Playgroud)
只要浏览器不将其\r\n视为真正的新行 - 您需要<br>使用nl2br()将它们"转换"为's'
| 归档时间: |
|
| 查看次数: |
8169 次 |
| 最近记录: |