Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Folder List With Pagination


I'm looing for a simple PHP file list program, that will show all the
files in a folder, but show them in batchs of 10 - 15..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

Pagination W/ Just Files In A Folder?
Example would be:

prev 12345 next

but doing this with just files and not DB records?

How Does One Get A List Of All Files In A Folder?
need a list of all files (i have like 5k or so) in a folder, I need to add there names to a table

I am doing this so i can compare two tables

table 1. comments added to uploaded pics -finished pictures-
table 2. no comments added yet to uploaded pics (so they can be commented on GET IT?)  -unfinished pictures-

All the pictures are in a single folder for the time being i'm going to be making a form based on the pictures that are on table 2 so that they can have comments and titles and file name added to table 1 (to be done still) but i need to know all the file names for the folder in question, i guess i could do it via cmd line ls or something like that, i'll get back to you.

Folder List Drop-Down
I am developing a PHP/MySQL project and as part of my initial setup and configuration scripts, the users can select a skin for the application, and a variable value ($skin) is updated to set the current skin, this works ok on it's own, but currently the user must manually type the skin name in a free-text box.

Ideally this needs to be a drop-down option box, and I would like this to be populated by listing the sub-folders within the '/skins' folder, so that it's always up to date. The folder structure looks like this:

/skins
/skins/skin1
/skins/skin2
/skins/skin3

How can I use PHP to generate a list of the current sub-directories in 'skins' and populate the drop-down list?

Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server.

I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).

Display A List Of Files In A Folder
How do you display a list of files in a folder and then delete one by clicking on it?

Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea
how to do this, while I can do other php without a problem. Once I
know how to go about it I'll be okay.
It's two things I think?
1. see if there's a trailing slash and delete it.
2. Remove the preceding path to /x, the folders and slashes, and
delete them.
and then I have x.

X by the way is the final folder in a website and this grabs it for
me.

<?
$name = $REQUEST_URI;
?>

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?

Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all
the bits and pieces together, all bar the code which takes the result of a
query and creates a list box.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

PHP Pagination
I would like my customers to be able to navigate between pages like, PREV 1 2 3 4 5 NEXT etc. I have managed to get this working using a combination of code created with dreamweavermx and by following the tutorial at php freaks. However i need the first page that loads to be page 1, so that the first link to be displayed will be for page 2. I'm nearly there but need a bit of help to overcome this. I have enclosed the code below as im not sure where to go from here.
Any help would be much appreciated.
Many thanks.
A working link
http://www.textual-intercourse.co.uk/pagination3.php


<?php require_once(); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

$maxRows_Recordset1 = 15;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db();
$query_Recordset1 = "SELECT polyphonictones.Id,Artist,TrackName,name FROM polyphonictones, ringtonegenre WHERE ringtonegenre.id = polyphonictones.Genre ORDER BY polyphonictones.Artist";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1,) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . implode("&", $newParams);
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php do { ?>
<?php echo $row_Recordset1['Id']; ?> <?php echo $row_Recordset1['Artist']; ?> <?php echo $row_Recordset1['TrackName']; ?> <br>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?><br>
<table width="493" height="130" border="1" align="left" cellpadding="1" cellspacing="1" bordercolor="#000000">
<tr>
<td width="485">
<?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
<?php } // Show if not first page ?>
<?php $totalPages_Recordset1 = $totalRows_Recordset1 / $maxRows_Recordset1;
for($i = 1; $i <= $totalPages_Recordset1; $i++){
if($i == $pageNum_Recordset1){
echo($i."&nbsp;");
}else{
echo("<a href="$PHP_SELF?pageNum_Recordset1=$i">$i</a>&nbsp;");
}
}


if(($totalRows_Recordset1 % $limit_Recordset1) != 0){
if($i == $pageNum_Recordset1){
echo($i."&nbsp;");
}else{
echo("<a href="$PHP_SELF?pageNum_Recordset1=$i">$i</a>&nbsp;");
}
} ?>
<?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
<br>
<?php } // Show if not last page ?></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Pagination Needs Help
I'm having trouble with pagination and haven't been able to find a site or thread to help. Here's what I'm doing:

I want to display only part of an article. The text from the field ('description')will contain hundreds of characters...I want to limit those characters at let's say...150, and display a "Read On..." link after that, that will link to a page that displays the entire article.

Pagination
I have been trying to get my pagination to work as it should. I am nearly there.

For example if I have 10 pages and the increment between them is set to one, all is well unitl I get to page 9. It should show

Prev 1 2 3 4 5 6 7 8 9 10 Next

but it misses the Next off. Any chance someone could pass their capable eyes of my code to see where I may be going wrong. It is not life threatening, just hindering me somewhat.

Cheers

##################
$filename = "test";
$page_num =9;
$s= $page_num;

//increment between pagination eg 1 2 3 next == 1
$n = 1;

$num_pages = 10;
$total_pages = $num_pages;
$e = min($s + $n - 1, $s + $num_pages - 1);

$pagin = "";
$pagin .= "<div id="options">
";
if ($s!= 1){
$previous = $s - $n;
if($previous == 1) {
$pagin .= "<A HREF="$filename.php">Previous</a>
";
}
else {
$pagin .= "<A HREF="$filename$previous.php">Previous</a>
";
}
};
for ($x = 1; $x <= ceil($num_pages/$n); $x++){
$current = ($x-1) * $n + 1;
if ($current == $s){
$pagin .= "$x
";

}else{
if($current == 1)
{
$pagin .= "<A HREF="$filename.php">$x</a>
";
}
else{
$pagin .= "<A HREF="$filename$current.php">$x</a>
";
}
};
};
if ($e + $s -1 < $total_pages){
$next = $s + $n;
$pagin .= "<A HREF="$filename$next.php">Next</a>
";
};
$pagin .= "</div>";
print "$pagin";

Pagination
Anyone have an efficient solutions for pagination? I have to display a
number of items but would like to paginate using only 10 lines of data
on each page and provide navigation at bottom.

Pagination
I have a small problem with one of my scripts, I have a pagination script and I've turn to the forum that I use and no one could help me, so I'll try this one. Let's see, my problem is a pagination script,I have this code:

Pagination
This process of paginating is breaking my brain! For the past several hours I have been following a tutorial that was not overly specific to my needs and turned out to have multiple errors in it. I have followed its process as best as I could, but it doesn't work. The script doesn't return an error, it just fails to paginate the results. Can someone give me a clue as to where I need to begin fixing this code:

Pagination
I am trying to find a really, really good pagination class that can be used to display them in multiple way's. Anyway have any they really like, or have created that I could use. I am looking for something that has a lot of features.

I always hated pagination, however after looking through classes I have found a lot that will cut down on time. Though I want to try to find one where the way you paginate can be changed around a little bit easier. Does anyone know of a really good one, that they have used.

How To Use Pagination
I have 7 columns in the table. The first 2 columns should not be changed and last 5 columns is used in pagination of columns.

How can I proceed with this.
Last 5 columns is users and when I click on NEXT the columns should change from A1 A2 A3 A4 A5 to A6 A7 A8 A9 A10. I should use pagination columnwise.

Php Pagination
I have implemented this but i seem to be having problems. When i go to the next page it changes this statement:

select * from sellproperty WHERE buylet='Buy' limit -10, 10
to this when i click on e.g. page 2.

select * from sellproperty WHERE buylet='Buy' limit 0, 10
but it does not like this statement and throws an error because it should be 10, 10 not -10, 10 i assume .

Now this is not the only problem i am having. I would have thought that when i go through the pages it would go up like so 10, 10 - 20, 10 - 30, 10 etc but page 1, 2 and 3 all say -10, 10.

My first question is how do i remove the - and also why is my code not going up in 10's? Code:

Pagination
I am running a Hot or Not program (except it isn't for people it is for painted miniatures) anyway, the user account would show all the miniature pictures uploaded and I needed a pagination to deal with this. Well I managed to get one to work (thanks by the way, all your tutorials and what not were invaluable) However, I do have one problem.

When a user access's there own account, they now see everyones miniatures that have been uploaded to the server. The images are held in a different database then the user info. What I am wondering is, how do I do the pagination so that it checks the id of the miniature image vs the id of the user so that it only displays the image that belongs to the proper user and not the whole image database.

I can post the script I have so far if needed.

McCragge

Pagination.
I've found a tutorial on pagination, seems like a decent tutorial.  However, all the tutorials i have seen on this subject, always use the "Select * FROM <table>".

My queries almost always have a Where statement inbedded into it.  How can i use my queries while still maintaining the tutorials guide, example of where my problem lies is below: Code:

Pagination
i used parts of the pagination script found on phpfreaks but have modified it abit.  So now my only issue i have is i need it to after giving me how many pages is to only display like 5 of the pages but on an upward route like

     < 1 2 3 4 5 >
   
what i want is lets say i want to limit the amount of pages in the pagination so that when i click 5 it shows me
     
     < 4 5 6 7 8 >

here is my code:

Getting A Url For Pagination
Is there a fasterway that doing a foreach($_GET) to get the 1,2,3,4 on a pagination??

Pagination
Can someone help me with my pagination ? I have used it fine before but i do not know how to impliment it on my current page.

I have a page that loops throught my database results and I want a new page to be created every 10 results. The page number is pulled from the url using $_GET Code:

Pagination
i have the following code and it all seems to work the only problem is it will only find one result, now to test i set the limit at 1 and inserted 3 fields manually it will echo one result but wont give me the option to get onto another 2 pages i echoed the total rows and it is only counting 1 any idea why? Code:

Pagination
I can display the page no problem. There are six entries in the database, I limit it to show only 2 per page. It shows Prev2 and Next 2 as well as current page on the bottom. But they do not show up as hyperlinks. Also too, this is returning that there is only 1 page, when there should be 3. Code:

Pagination
I'm trying to break a listing into pages with 10 listings per page. I have read through the pagination tutorial and is having difficulty implementing the codes. Please point me toward the correct direction. Here is the original listing code:

Pagination
I want to put a pagination on bottom of the page and I have like 100 page numbers or more, so I want to show only 5 page numbers on both sides of the current page, if u know what i mean like:

Prev .. 8 9 10 11 12 13 14 15 16 17 .. Next

when i move to the right or left then i add or subtract one. Here 's what i have so far:

for ($i = 1; $i <= $numPages; $i++) {
        echo " ";
        if ($i == $pageNum)
            echo "$i";
        else
            echo "<a href="?page=$i">$i</a>";
 }

Best Way Of Pagination.
which would you consider the best way of doing pagination?

by putting the result in a array or by using mysql.

right now i have it with mysql but i was thinking about putting all result in a array and then do the paging threw an array, but i dont know about speeds in php.

which way would be faster?

Pagination
I am having a bit of trouble getting my pagination to work correctly as there are some obstacles I have to work around in this specific script.

I have the script recognizing how many results there are, and it correctly displays the amount of pages there should be for the amount of data, but when I try to go to any other page than the first, it loses the rest of the rows and doesn't display anything.

Here is my code, I have narrowed it down as much as possible and deleted things you don't need to see so it is easier for you to look through. Code:

Pagination
Im using the pagination successfully, but now i do have quite alot of pages being given in results

eg
QuotePREV15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 NEXT15

im using the standard Code:

Pagination
I have this script which i got from PHPFreaks.com and im trying to print the results that are being shown the only way i can see doing it is like below but I cant see me coding that for every page. Has anyone got any better ideas? Code:

Pagination
i am trying to use a pagination script that is from a tutorial on here i was given a link to and basically i can get information to display on first page and it brings up standard text saying under PREV5 1 NEXT5 but it isnt a link or interactive so i cant get next 5 records or last so i have 5 records on screen but cant navigate between them.

But i cant see why the screen shows only 5 records there are no error codes can anyone see what i have done wrong please as i feel like im going round in a circle. Code:

Pagination
I have the paging script in this php file and this is for the members section of my site.

When it shows all members it works correctly with the exception of a number "1" next to the "Last" Box and I cannot figure out where that problem is.

Also I have this set up to where members can "view all members" or "view only members with avatars". When you click to view only members with avatars it shows the correct first page of members with avatars but it shows the incorrect members with avatars count from the database and when you click another page it snaps back to the viewing all members pages.

I have attached a picture of what it looks like and here is the php code....

Pagination + While Statements = ???
How would I do that? I've added pagination to some of my scripts before,, but I always used if statements for that.. how to do it in while statements?

Another Pagination Question!
Is it possible to make pagination from outputs from a while statement. If it is, then how?

Pagination With MySQL
Well it's extremely early on Saturday morning and, well....I'm bored. :)

Anyway, there have been some questions about Pagination with MySQL, so I decided to write up something real quick. I believe the comments within the code explain it all.

Please excuse me if there are any typos...I'm tired ;)


<?php

/*
Check whether the 'page' GET variable is not defined or equals zero.
In either case, an error is sent and the script terminated.
*/

if(empty($_GET['page'])) {
echo 'Page number is not defined!'
exit();
}

/*
The following makes sure that the 'page' variable only contains numbers,
therefore limiting it to just integers(whole numbers).
*/

else if(!preg_match("/^([0-9])+$/",$_GET['page'])) {
echo 'Page is not a valid value!'
exit();
}

/*
If the 'num' GET variable isn't defined in the URI, then the var num_per_page is by default set to 10.
This utilizes the ternary operator. After the check for existence, then there is a check to make sure that
the string contains only an integer using the same method as above.
*/

$num_per_page = (empty($_GET['num']))? 10 : $_GET['num'];
if(!preg_match("/^([0-9])+$/",$num_per_page)) {
echo 'Num is not a valid value!'
exit();
}
//Get the page number from the URI; the pages start when page=1, not page=0
$page = $_GET['page'];

/*
Connect to database and then select a database.
You can also include this information if you want, but this is just an example ;)
*/

$link = mysql_connect('localhost','username','password');
mysql_select_db('database');

/*
This piece is the essence of pagination. Using LIMIT in the mysql query is what we are going
to use for this. The following line creates a new variable, qPage, which is the value of the
page number minus one times the number of rows you want to show up on each page.
For example, if page = 1 in the URI, then 1-1*10 = 0. This is the offset for the LIMIT in the query.
If page = 2then 2-1*10 = 10. Since 10 is the number per page in the example, then it only makes sense
to start the next limit at an offset of 10.
*/

$qPage = (($page-1)*$num_per_page);

/*
The following is the query of the pagination; this is where the magic takes place.
the SELECT is self-explanatory. The LIMIT is the most important. LIMIT has the syntax
LIMIT [offset],[length]. Knowing this format you should be able to follow the query now.
Now for the following you are probably wondering why I added 1 to the value for the number per page.
I did this simply to know if there is going to be another page after the current one. We will need this
information later when we are echoing out the 'Next page' link.

Note: You may want to change the query to fit your needs, however the LIMIT clause should stay the same.
Everything else can be changed :)
*/

$query = "SELECT * FROM `table` ORDER BY `col_name` ASC LIMIT ".$qPage.",".($num_per_page+1);
//You should remove the 'die(mysql_error());' part of the following after development
$result = mysql_query($query) or die(mysql_error());

/*
Here 'num' is set to the number of rows that the above query returned. The condition simply
sees if the number of rows returned equals zero, because if it does than that means that there
are no more rows for the specified LIMIT.
*/

$num = mysql_num_rows($result);
if($num == 0) {
echo 'No more results!'
exit();
}

/*
Here's is another interesting part. At first thought one may want to use a while loop here.
The only problem with the while loop is that it echos that last row that we selected in the
query when we don't want it to. Instead of handling this it's easier to use a for loop
instead, using the num_per_page variable as shown. Obviously you can format the HTML and PHP
output however you'd like; I'm just outputting the array as an example.
*/

for($i = 0; $i < $num_per_page; $i++) {
$row = mysql_fetch_array($result);
echo '<pre>'
print_r($row);
echo '</pre>'
}
mysql_close($link); //Close the link to the MySQL database.

/*
This goes back to selecting that extra row in the query. If the amount selected (num) is
greater than the number per page(num_per_page) than that means that there is at least one more
row to be returned after the the range that you want, therefore you know you can echo the 'Next Page'
link without having to worry if you are linking to a blank page or not.

The rest should be self-explanatory. If you are going onto the next page, you are going to increment the
page variable by one, and of course you still want to keep the current number per page otherwise you may
see repeats, so you just echo that value in it's corresponding place within the url query.
*/

if($num > $num_per_page) {
echo '<a href="index.php?page='.($page+1).'&num='.$num_per_page.'">Next Page</a>'
}
echo '<br/>' //Just acts as a separator for the two links ;)

/*
The following acts the same way as above, however instead of incrementing you are subtracting one from the
page variable to 'go back' to the previous page. Obviously you do not want to 'go back' when you are on the first page
to begin with, so we first check to make sure that the page value is larger than &#391;' (our first page) before we start
echoing it to the browser.
*/

if($page > 1) {
echo '<a href="index.php?page='.($page-1).'&num='.$num_per_page.'">Previous Page</a>'
}

?>


There are also many other related threads on this topic. Here's a few:
http://www.webmasterworld.com/forum88/5119.htm
http://www.webmasterworld.com/forum88/2880.htm
http://www.webmasterworld.com/php/3088021.htm
http://www.webmasterworld.com/forum88/9755.htm
http://www.webmasterworld.com/forum88/4255.htm
http://www.webmasterworld.com/forum88/6510.htm
http://www.webmasterworld.com/forum88/11904.htm


If anyone can add something, please do. I know I'm missing something ;)

Pagination Problem
I try to make a pagination system work on a page of results that come from a form. The results get fine to the results page (with the right limit specification, but I am unable to pass the following results to next page. I think the problem could be on two places:

Or I made a mistake in my form which looks like this:

Paginating (pagination)
it seems that the next button is ok but the previous button does not go to the write page but it goes to itself. it is a basic question and answer database with each q&a showing up on a single page. PHP Code:

Pagination With PHP & MSSQL
I know this is a PHP mailing and i'm sorry that my first post is
mainly to do with MSSQL but i'm after a method of pagination with
MSSQL data and PHP.

There seems to be an endless amount of scripts and methods with MySQL
and the limit function but i'm yet to find a method with MSSQL that
doesn't involve PEAR (apparently it's not allowed to be installed on
the server!)

Pagination Through Database
I have some pages that will be spitting out information from a database with live 1500 lines of entries and I would like to paginate each page to LIMIT the output for 50 queries each page. I am having trouble doing a LIMIT loop with my queries. Anyone got some good tips?

Pagination Solution
how to createa pagination just like the one in vBulletin. Yesterday, I asked a question about making sure that I get 10 pages per page, even though some of the things get deleted. I went back to work on that right now, and I can't imagine how easy it is - it's logical too!! I present my solution for those who MIGHT want to know. PHP Code:

Pagination Code
First off, hello to everyone, its my first time here and after reading some helpful googled forum posts about other difficulties I was having that came up from this site, I thought i would join.

Heres my current situation, Im working on a site learning PHP as i go with manuals, reading sites online etc, Ive done ok so far and I'm learning a lot. I've come to a bit of a hurdle tho at this point.

------------------------------------------------------------------------
Pagination, Using a tutorial on the internet I am close to having it working but I have hit a snag. Here is the situation. I have got a search page that passes on these variables :

Keep Variables In Pagination
i'm trying to set pagination for a search i run on my website, i'll
try to explain the easiest i can:

When i click the search button on search.php, data is received and
stored in variables within results.php, MySQL structure seems to work
as expected, although i get some problems:

As soon as i click on the "Page 2" Link, i get nothing, neither results
nor page numbers.

I know why this happens: after clicking on any "Page X" link, the page
self-reloads and this changes the stored value in the VARIABLES (i
assume to 0 or nothing), therefore, MySQL structure doesn't work, since
there's no correct data to set the query.

Stating the obvious, if i set a fixed value instead of a variable my
structure perfectly works:

Pagination Problem
I've got one of those problems that you know the problem is simple, but
you've been staring at it for too long to make sense anymore.
Basically, I have the following function to help step through a database
by displaying Previous and Next links, depending on some variable sent
to it.....

Finding Pagination
First, let me say this is NOT a "How do I paginate my results?" question. I know how that works. Problem: I have items that are listed by date and medium. Both have paginated listings for searching for items. What I need to do is go back to either list to the page where the current item is listed.

Say item #10 is listed on page 1 of dates, and page 5 of mediums [simplified for illustration]. I want the user to be able to come from dates - then move to the mediums listings, while finding the item just viewed on the resulting page.

To determine the mediums listing I tried a function where I looped through a pagination function looking for the $id of the item in the result set with in_array(). It would only return the highest page number, if it returned anything. I have really trashed the function, and have to start from scratch. It seems my logic is wrong. Code:

Advanced PHP Pagination
Is there anyone who could help me create an advanced pagination code? The basic:

1. Data to paginate will be coming from msyql database.
2. 10 or 20 items per page.
etc, etc...

The problem: Limit the number of page numbers to 5 when pages reach more than 5 pages.

Example: Total pages: 10

sample page listing output:

start of pagination
1.) << 1 2 3 4 5  >>

displayed when last page number is clicked (5) on start of pagination
2.) << 3 4 5 6 7 >>

Page Pagination?
My script is only showing the first 10 results on every page that my page declares. Basically I have 5 pages and the script shows that correctly on the browser, but when I click on the link to go to page 2 my script pulls up the same results. Can some one help with my coding? Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved