-
-
$conn = @ mysql_connect("localhost", "root", "123456") or die("数据库链接错误");
- mysql_select_db("bbs", $conn);
- mysql_query("set names 'gbk'"); //使用gbk中文编码;
- //将空格,换行转换为html可解析
- function htmtocode($content) {
- $content = str_replace("\n", "
", str_replace(" ", " ", $content)); //两个str_replace嵌套
- return $content;
- }
- //$content=str_replace("'","‘",$content);
- //htmlspecialchars();
-
- ?>
复制代码
3)显示页面
[code]
$numq=mysql_query("select * from `message`");
$num = mysql_num_rows($numq); //总数
if($_get
|