conn.php
<?php
$conn = @ mysql_connect("localhost", "root", "") or die("数据库链接错误");
mysql_select_db("liuyanban", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>
list.php
<?php
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select * from `message`";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
echo "<tr bgcolor='#eff3ff'>";
echo "<td>标题:".$row[title]." 用户:".$row[user]."</td>";
echo "</tr>";
echo "<tr bgColor='#ffffff'>";
echo "<td>内容:".$row[content]."</td>";
echo "</tr>";
}
?>
</table>
<?php
$conn = @ mysql_connect("localhost", "root", "") or die("数据库链接错误");
mysql_select_db("liuyanban", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>
list.php
<?php
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select * from `message`";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
echo "<tr bgcolor='#eff3ff'>";
echo "<td>标题:".$row[title]." 用户:".$row[user]."</td>";
echo "</tr>";
echo "<tr bgColor='#ffffff'>";
echo "<td>内容:".$row[content]."</td>";
echo "</tr>";
}
?>
</table>
留言板系统搭建
本文介绍了一个简单的留言板系统的实现过程,包括数据库连接、数据查询及显示等功能。通过PHP语言和MySQL数据库结合,实现了用户留言内容的存储与展示。
2万+

被折叠的 条评论
为什么被折叠?



