Aaron,

Normally you control that output server-side by limiting the result
in
your SQL. Look at help for the SELECT statement and the LIMIT clause.

If you really want to send everything back at once, you'll need for
PHP to output
the table HTML so that it looks something like this skeleton.

<table>
<thead>
  <tr><th>...</th><th>...</th><th>...</th></tr>
</thead>

<tbody id="page1">
  <tr><td>...</td><td>...</td><td>...</td></tr>
  ...
  <tr><td>...</td><td>...</td><td>...</td></tr>
</tbody>

<tbody id="page2">
  <tr><td>...</td><td>...</td><td>...</td></tr>
  ...
  <tr><td>...</td><td>...</td><td>...</td></tr>
</tbody>

  ... etc ...

<tbody id="page10">
  <tr><td>...</td><td>...</td><td>...</td></tr>
  ...
  <tr><td>...</td><td>...</td><td>...</td></tr>
</tbody>
</table>

Each tbody will contain 20 rows of output. The last one will contain
from 1-20 rows depending on your page size.

You'll need to also output links that correspond to the various pages.

Your Javascript will hide all all tbody, except for the page you want
to display.

Look at the jQuery show() and hide() functions. You'll need to bind a
click event to each of the page links. That event would have a
function that hides the pages you don't want to show, and shows the
page you do.

You might also want to look at this plugin.  
http://plugins.jquery.com/project/pagination

On Sep 10, 2:03 pm, Aaron <[EMAIL PROTECTED]> wrote:
> I am working on a website and I am trying to create a table. I plan to
> use php to generate the table with data from the mysql database to
> fill up the table however I want to set a max on that amount and if it
> goes over I want to generate other pages or create on the fly links to
> load to take the data that is in the table and load in the other data.
>
> I can't fully explain it.
>
> SO examples would be like ebay or any board form if you notice like on
> ebay if you searched cars and you get all the listings of cars and
> notice that their are links on top of the table saying
> 1,2,3,4,5,6,next
>
> ect. How can I generate something like that where I can list data that
> has been stored.
>
> I just want to make a table which when it is to the limit it would
> generate a link or something that would display the new information.
>
> I was hoping I could do this with javascript.  SO  for example lets
> say I have  100 posts listed but I want to make the code in a way
> where it divides this 100 posts  into pages so if I can fit only 20
> per page then this would mean I would need to generate 5 pages that
> display 20 posts each page.
>
> What could you suggest to me is the best way on  doing this??

Reply via email to