![]() |
|
#1
|
|||
|
|||
Page BreaksHi,
I would like to enter a search value in a form (done in html) and send the value to the PHP file that would query the my-SQL database table and display the results showing a specified number of pages and allowing to move to the next page until all is done. NOTE: the form and the PHP file are two separate files. Pliz help. |
|
#2
|
||||
|
||||
Re: Page BreaksThis is actually fairly easy. For the first page of results... let's say that you only want to show 10 items at a time. In your MySQL query, use the LIMIT keyword to limit the amount of rows that mysql returns.
For instance: Code:
That query will get you the first 10 results from that query. The 0 after the LIMIT tells yuo where to start and the 10 tells you how many rows to get. Now, to get the next 10 results, all you have to change is this: Code:
That will start at the 11th result (like arrays 0 is the first element... so 10 is actually the 11th) and get the next 10. So one easy way to do that in PHP is to pass the values of where to start and how many elements to get as URL arguments. Code:
(I only put that in code tags because it wouldn't quit hyperlinking the text. It's only an example... not a link) Then you can use those values to insert into your MySQL query and viola. The lowlimit variable holds the value of where to start, and the n variable tells you how many rows to return. So, all you have to alter in each pages "NEXT" link is to add 10 to the lowerlimit variable. As for the "PREVIOUS" link, you just need to subtract 10. __________________
If practice makes perfect and nobody's perfect... why practice? Homepage: http://www.treywhite.com Blog: http://www.treywhite.com/blog.php Web Design Company: http://www.ewebproductions.com |
|
#3
|
|||
|
|||
Re: Page Breakswow that just helped me out a lot thanx TreyAU21
|
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Page Rank vs. Google listing | crystalattice | Search Engine Optimization Forum | 8 | 15-Mar-2007 03:49 |
| Loading a php page in an iframe from javascript | Clive73 | Web Design Forum | 0 | 18-May-2005 06:10 |
| next page | skyloon | MySQL / PHP Forum | 5 | 17-Oct-2004 12:04 |
| [script] E-mail webmaster error page | BobbyDouglas | PHP Code Library | 0 | 19-Aug-2003 20:10 |
| Search Engine Positioning 101 and 201 "How To" Tips... | 000 | Search Engine Optimization Forum | 0 | 29-May-2003 10:34 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The