[原创]留言板显示的问题!不能显示完全! |
这是index.php
------------------------------------------------------------
<?php session_start(); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>科科个人的留言板</title>
<style type="text/css">
<!--
.css {
font-family: "宋体";
font-size: 14px;
}
-->
</style>
</head>
<body topmargin="0">
<table width="600" border="1" align="center" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#FFFF99" class="css">
<tr>
<td height="12" align="center" bgcolor="#FFFF99">科科自己设计制作的留言板 </td>
</tr>
<tr>
<td height="13" align="center" bgcolor="#FFFF99">你好!今天是:
<?php $day=date("D");
switch ($day){
case "Mon" :
echo "星期一" ;
break;
case "Tue" :
echo "星期二" ;
break;
case "Wed" :
echo "星期三" ;
break;
case "Thu" :
echo "星期四" ;
break;
case "Fri" :
echo "星期五" ;
break;
case "Sat" :
echo "星期六" ;
break;
default:
echo "星期天" ;
break;
} ?>
</td>
</tr>
</table>
<table width="600" border="0" align="center" cellspacing="0" class="css">
<tr>
<td height="122">
<form name="form1" method="post" action="act.php">
<table width="600" height="285" border="1" align="center" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#FFFFCC" class="css">
<tr>
<td width="163" height="22" align="center">您的姓名:</td>
<td width="427"><input type="text" name="username"></td>
</tr>
<tr>
<td height="20" align="center">留言标题:</td>
<td width="427"><input type="text" name="title"> </td>
</tr>
<tr>
<td height="58" align="center">留言内容:</td>
<td width="427"><textarea name="content" cols="55" rows="5"></textarea></td>
</tr>
<tr>
<td height="5"> </td>
<td width="427"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置">
</td>
</tr>
<tr>
<td height="5" colspan="2">
<?
include("conn.php");
$execc="select count(*) from note ";
$resultc=mysql_query($execc);
$rsc=mysql_fetch_array($resultc);
$num=$rsc[0];
$rscount=$num;
$pagecount=ceil($num/10)-1;
if (empty($_GET["page"])){
$page=0;
}
else{
$page=$_GET["page"];
if($page<0)$page=0;
if($page>$pagecount)$page=$pagecount;
}
$query="select * from note order by name desc limit ".($page*10).",10";
$result=mysql_query($query);
if(mysql_num_rows($result)<=10){
$shuchu=mysql_num_rows($result);
}else{
$shuchu=10;
}
if($shuchu!=0){
for($i=1;$i<=$shuchu;$i++){
$info=mysql_fetch_object($result);}
}
?>
</td>
</tr>
<tr>
<td height="5" colspan="2">留言编号[
<? echo $info->id?>
]
<? echo $info->title?>
</td>
</tr>
<tr valign="top">
<td colspan="2">
<? echo $info->name?>
<br>
<? echo $info->content?>
</td>
</tr>
<tr>
<td height="10" colspan="2">共(
<? echo $num?>
)条,分(
<? echo $pagecount+1?>
)页,当前是第(
<? echo $page+1?>
)页</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
------------------------------------------------------------
这是连接数据库的文件conn.php
------------------------------------------------------------
<?
$link=mysql_connect("localhost","keke","8426406");
mysql_select_db("kk",$link);
?>
------------------------------------------------------------
这是处理文件act.php
-----------------------------------------------------------
<? session_start(); ?>
<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01 TransitionalEN" "http:www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>处理中……</title>
</head>
<body>
<?php
$username=$_POST["username"]; /* 将接收到的post数据username(用户名)赋予变量username */
$content=$_POST["content"]; /* 将接收到的post数据content(留言内容)赋予变量content*/
$title=$_POST["title"];
if($username==''||$content==''||$title==''){
echo ("您的姓名或留言标题、者留言内容有一项为空,请返回重新将其填写完整。");
echo ("<a href='index.php'>[返回]</a>");
}
else{
include("conn.php");
$exec="insert into note(name,content,title) values('$username','$content','$title')";}
//$result=mysql_query($exec);
//echo $result;
if($result=mysql_query($exec))
{
echo ("留言已经成功提交");
echo ("<a href='index.php'>[返回]</a>");
}
else{
echo ("留言提交失败,请返回重新检查输入信息是否包含.'\"\\等信息。");
echo ("该留言本不支持此类敏感标点符号。");
echo ("<a href='index.php'>[返回]</a>");
}
?>
</body>
</html>
---------------------------------------------------->
都位于同一目录下,数据库为kk,表
#
# 数据表的结构 `note`
#
CREATE TABLE note (
ID int(3) NOT NULL default '0',
name varchar(10) NOT NULL default '',
title varchar(50) NOT NULL default '',
content varchar(100) NOT NULL default ''
) TYPE=MyISAM;
#
# 导出下面的数据库内容 `note`
#
INSERT INTO note VALUES (0, '陈芳', '好样的', '这次取得这么好的成绩,都是大家的功劳!');
INSERT INTO note VALUES (0, '朱红', '劳苦功高啊', '取得这么好的成绩,谢谢你了!');
INSERT INTO note VALUES (0, '李小芳', '你好', '好久不见你了');
INSERT INTO note VALUES (0, '吴文华', '你好啊!', '好久不见你了哦!最近在干什么啊?');
INSERT INTO note VALUES (0, '趋于', '下雨', '真坏上士战无不胜互相帮助可耕地互相帮助枯聊表寸心 本');
-------------------------------------------------------
现在只能显示一条,大家帮帮忙啊!
|
|
|