| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Feb 2006 Location: Chicago IL
Posts: 73
![]() | Pagination Problems.... Hi there! making a portfolio page for my website, and the code seems to work. but the links for pagination do not show up Here are the files I'm working with Contents of the callid_port.php file Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Portfolio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include('config.php');
// request text from all the jokes
include('pagination.php');
echo("<table class='prod' cellpadding='3' border='3'>");
echo("<tr><td colspan='4'><h3 align='center'>Sort Portfolio By: <a href='id.html'>All</a> | <a href='dsnrs.html'>Designer</a> | <a href='live.html'>Live Sites</a></h3></td></tr>
<tr>
<td><h4 align='center'> Design Thumbnail </h4></td><td><h4 align='center'> Design Title </h4></td><td><h4 align='center'> Design Author </h4></td>
<td><h4 align='center'> Design URL </h4></td>
</tr>
");
while ( $row = mysql_fetch_array($result) ) {
$id = $row["ID"];
$dsnr = $row["dsnr"];
$img = $row["img"];
$live = $row["live"];
$port_desc = $row["port_desc"];
$href = $row["href"];
$title = $row["title"];
if (empty($row)) {
echo("<h1>Coming Soon!</h1>"); }
elseif($live==1){
$ahref = "<a href='" . $href . "' target='_blank'>" . $title . "</a> *Live Site!*" ;
}else ( $ahref= "Not Live" );
echo("<tr><td class='td2'>" . "<a href='/images/" . $img . "' target='_blank'><img width='90px' height='120px' src='/images/" . $img . "' title='Click For Larget Image' border='0' /></a>" . "</td><td class='td3'><p align='center'>" . $title . "</p>" . "</td><td class='td4'>" . $dsnr . "</td><td class='td5'>" . $ahref . "</td></tr><tr><td colspan='4'><blockquote> <p align='left'>Design Description:</p>" . $port_desc . "</blockquote></td></tr>");
}
include('pagination2.php');
echo("</table>");
;
?>
</body>
</html> ????: NamePros.com http://www.namepros.com/programming/170787-pagination-problems.html Contents of pagination.php Code: <?
$limit = 5;
$query_count = "SELECT count(*) FROM port";
$result_count = mysql_query($query_count);
$totalrows = mysql_num_rows($result_count);
if(empty($page)){
$page = 1;
}
$limitvalue = $page * $limit - ($limit);
$query = "SELECT * FROM port LIMIT $limitvalue, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
if(mysql_num_rows($result) == 0){
echo("Nothing to Display!");
}
?> Code: <?
if($page != 1){
$pageprev = $page--;
echo("<a href=\"callid_port.php&page=$pageprev\">PREV".$limit."</a> ");
}else{
echo("PREV".$limit." ");
}
$numofpages = $totalrows / $limit;
for($i = 1; $i <= $numofpages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"callid_port.php?page=$i\">$i</a> ");
}
}
if(($totalrows % $limit) != 0){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"callid_port.php?page=$i\">$i</a> ");
}
}
if(($totalrows - ($limit * $page)) > 0){
$pagenext = $page++;
echo("<a href=\"callid_port.php?page=$pagenext\">NEXT".$limit."</a>");
}else{
echo("NEXT".$limit);
}
mysql_free_result($result);
?> ????: NamePros.com http://www.namepros.com/showthread.php?t=170787 Any Ideas? (Link To Page TIA
__________________ Hassle Free Computing and Web Solutions for Personal and Business! Rochelle Network Communications!
Last edited by AllValley; 02-24-2006 at 09:34 AM.
|
| |
| | #2 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | For pagination, try: PHP Code: PHP Code: ![]() -Eric |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Member Join Date: Feb 2006 Location: Chicago IL
Posts: 73
![]() | The links still aren't working :S
__________________ Hassle Free Computing and Web Solutions for Personal and Business! Rochelle Network Communications! |
| |
| | #4 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Ok, try this. And this is all one file btw ![]() ????: NamePros.com http://www.namepros.com/showthread.php?t=170787 PHP Code: |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems. They can ruin your day if you don't have the right perspective. | BobParsons.com | Business Development | 0 | 12-17-2005 12:38 AM |