- 论坛徽章:
- 1
|
显示不出其它的数据,怎么回事?请高手帮看看,为什么只能显示第一个记录的数据?
显示结果如下:
网上地址簿
升序显示 降序显示
这一页没有数据了
联系人编号 姓名 电话 地址 生日 最近会面日期 更多的说明
1 toner hubei 0000-00-00 0000-00-00
后一页
//disp.php
<?php
require('pre_inc.php');
$records_one_page=6;
if (strlen($initial_record)==0) {
$initial_record=0;
}
?>;
<TABLE border="0">;
<tr>;
<TH>;
<?php echo "<a href=\"$php_self?sort_field=recent_date&sort_way=ASC\">;升序显示</a>;";
?>;
</TH>;
<TH>;
<?php echo "<a href=\"$php_self?sort_field=recent_date&sort_way=DESC\">;降序显示</a>;";
?>;
</TH>;
</tr>;
</TABLE>;
<TABLE border="1" cellpadding="4" cellspacing="0">;
<TR>;
<TH>;联系人编号</TH>;
<TH width=80>;姓名</TH>;
<TH width=100>;电话</TH>;
<TH width=100>;地址</TH>;
<TH width=100>;生日</TH>;
<TH width=100>;最近会面日期</TH>;
<TH>;更多的说明</TH>;
</TR>;
<?php
$char_sql="select * from $table_name where mark_deleted='N'";
$result=@mysql_db_query($db_name,$char_sql,$link_message);
$rows_number=@mysql_num_rows($result);
if (strlen($sort_field)==0) {
$char_sql="select *from $table_name where mark_delete='N' limit $initial_record,$records_one_page;";
} else {
$char_sql="select *from $table_name where mark_delete='N' order by $sort_field $sort_way limit $initial_record,$records_one_page;";
}
$rows_number_currentpage==@mysql_num_rows($result);
if ($rows_number_currentpage==0) {
echo "这一页没有数据了";
} else {
$next_page_start=$initial_record+$records_one_page;
if ($next_page_start>;$rows_number) {
$next_page_start=$rows_number;
}
$start=$initial_record+1;
echo "显示从第".$start."到第".$next_page_start."条的信息";
$pre_page_start=$initial_record-$records_one_page;
if ($pre_page_start<0) {
$pre_page_start=0;
}
}
for ($index=$start;$index<=$next_page_start;$index++)
{
$record=@mysql_fetch_object($result);
require('display_a_recorder.php');
}
?>;
</TABLE>;
<table border="2">;
<th>;
<?php
if ($initial_record!=0) {
$start="initial_record=$pre_page_start";
if (strlen($sort_field)==0) {
echo "<a href=\"$php_self?$start\">;前一页</a>;";
}else{
echo "<a href=\"$php_self?$start&sort_field=$sort_field";
echo "&sort_way=$sort_way\">;前一页</a>;";
}
}
?>;
</th>;
<th>;
<?php
if ($next_page_start!=$rows_number) {
$start="initial_record=$next_page_start";
if (strlen($sort_field)==0) {
echo "<a href=\"$php_self?$start\">;后一页</a>;";
}else{
echo "<a href=\"$php_self?$start&sort_field=$sort_field";
echo "&sort_way=$sort_way\">;后一页</a>;";
}
}
?>;
</th>;
</table>;
两个包含文件:
//pre_inc.php
<p>;<FONT SIZE="+3" color="#33cc66">;网上地址簿</FONT>;</p>;
<?php
$username='address';
$passwd="address";
$db_name='baby_db';
$table_name='address';
$link_message=@mysql_connect('localhost',$username,$passwd);
if (!$link_message)
{echo "对不起,数据库连接错误!";
exit();
}
?>;
//display_a_recorder.php
<TR>;
<TD>;<?php echo $record->;id ?>;</TD>;
<TD>;<?php echo $record->;name ?>;</TD>;
<TD>;<?php echo $record->;tel ?>;</TD>;
<TD>;<?php echo $record->;address ?>;</TD>;
<TD>;<?php echo $record->;bir ?>;</TD>;
<TD>;<?php echo $record->;recent_date ?>;</TD>;
<TD>;<?php echo $record->;more ?>;</TD>;
</TR>; |
|