said: "Here it is:
[code]
");
while($row = mysql_fetch_array($result)){
if ($bgcolor == "#E0E0E0"){
$bgcolor = "#FFFFFF";
}else{
$bgcolor = "#E0E0E0";
}
echo("
| ");
$memname = $row['username'];
echo "$memname";
echo(" | ");
echo($row["name"]);
echo(" | ");
$num = $row['created'];
echo "$num | ";
echo "";
$member = $row['email'];
//totalcounts($member);
}
echo("");
echo "
";
if($page != 1){
$pageprev = $page-1;
echo("Previous ".$limit." ");
}else{
echo("PREV".$limit." ");
}
$numofpages = $totalrows / $limit;
for($i = 1; $i <= $numofpages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("$i ");
}
}
if(($totalrows % $limit) != 0){
if($i == $page){
echo($i." ");
}else{
echo("$i ");
}
}
if(($totalrows - ($limit * $page)) > 0){
$pagenext = $page+$page;
echo("Next ".$limit."");
}else{
echo("NEXT".$limit);
}
mysql_free_result($result);
function totalcounts($member) {
include "/home/webs/information/db.ini";
include "DB.php";
$db2 = DB::connect($dbconfig);
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_error2');
$q="SELECT * FROM celeb WHERE authoremail='$member'";
$result = $db2->getAll($q, DB_FETCHMODE_ASSOC);
$uResult = $db2->query($q);
$i = 0;
$vi = 0;
while ($uRow = $uResult->fetchRow()) {
$views = $uRow[22];
$i++;
$vi+=$views;
}
echo "$member has $i articles with $vi views";
}
?>
[/code]
The code is working for me. I converted this from a few web pages that I found and fixed a few errors in the code. Enjoy."
Darren said: "You can see this in action at [url=http://www.webs-best-directory.com/members/]Members Directory[/url]
Obviously, make sure to change the SQL query to something appropriate for you."
Neutron2k said: "that is a VERY long script for pagination.
i had to think pagination through and ended up with a small script :)
its in asp though and in use on the new pet drug store i have been building for the last 7 months. was finished a long time ago but adding products and new content to it at present. will not be live for a long while yet though.
have to sort out hosting and psp etc with the vet."
Darren said: "Well when you convert it to PHP, let us know :)"
|