这个类的主要功能是生成一个分页的导航条,就是“上页,下页”之类的
而真正的数据分页还需要重新查询的
例如:
$limitStr = $p->limitStr();
$sql="select * from t_goods where goodstype='$type' ".$limitStr;
然后用这句sql语句得到你真正本页的数据
而真正的数据分页还需要重新查询的
例如:
$limitStr = $p->limitStr();
$sql="select * from t_goods where goodstype='$type' ".$limitStr;
然后用这句sql语句得到你真正本页的数据
include "pageft.php";
$mysql_link=mysql_connect($host,$user,$password);
mysql_select_db($bdb,$mysql_link);
$type=$_GET["cat"];$str = "select count(*) from t_goods where goodstype='".$type."'";
$db->query($str); //这里报错了。。请大家解释一下
$db->next_record();
$recordcount = $db->f(0);//记录总数
$p =New Page($recordcount, 10 );
$p->trunStr = array( "First", "Prev", "Next", "End" );//设置分页显示字符
$sql="select * from t_goods where goodstype='".$type."'".$p->limitStr();
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
?>
//省略显示内容
<?
}
?>
<?php
echo $p->printPage();
?>你忘记了把limitStr()拿过来了。
<?
include "pageft.php";
$mysql_link=mysql_connect($host,$user,$password);
mysql_select_db($bdb,$mysql_link);
$type=$_GET["cat"];
$str="select count(*) from t_goods where goodstype='$type'";
$db->query($str); //这里报错了。。请大家解释一下
$db->next_record();
$recordcount = $db->f(0);//记录总数
$p =New Page($recordcount, 10 );
$p->trunStr = array( "First", "Prev", "Next", "End" );//设置分页显示字符
$limitStr = $p->limitStr();
$sql="select * from t_games where goodstype='$type'".$limitStr;
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
?>
//省略显示内容
<?
}
?>
<?php
echo $p->printPage();
?>之后,$db->query($str); 这里报错的问题还是没有解决啊
<?
include "pageft.php";
$mysql_link=mysql_connect($host,$user,$password);
mysql_select_db($bdb,$mysql_link);
$type=$_GET["cat"];
$str="select count(*) from t_goods where goodstype='".$type."'";
$result=mysql_query($str);
$row=mysql_fetch_array($result);
$recordcount = $row[0];//记录总数
unset($row);$p =New Page($recordcount, 10 );
$p->trunStr = array( "First", "Prev", "Next", "End" );//设置分页显示字符
$limitStr = $p->limitStr();
$sql="select * from t_games where goodstype='".$type."'".$p->limitStr();
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
?>
//省略显示内容
<?
}
?>
<?php
echo $p->printPage();
?>