Hi all,

I have a table which holds 130 companies and their related details.
I have done the code to insert the information into the table when new companies come along. But now I need to display the existing information. I am looking at doing it using a form for now, will change over to CSS when I get the hang of it!
My problem is not the display of the information, but I would like to have a few buttons at the bottom of the form which will then go to the next record, previous record, first record, last record (old access style) once the button is clicked.

Can I get some guidance on this please?

Member Avatar

You have a few options - you can load all the info and show/hide with javascript or you can load one at a time using vanilla php or ajax.

This is very similar to "pagination".

Downside with the first method is that it may be slow to load initially as you pile on the number of companies and also new companies inserted by you will not show up (nor will updated info) if the user is in the middle of paging through the list. However, it should be lightning fast in paging through.

The second method needs a round trip to the server with a new SQL query every time you page through. New data if added to the end of the list, should ensure that these are available to the user. However, the time to show a new company will be slower - but if data is simple without too much processing, you may not notice too much (ajax option). If you just use php (no js), then the page will reload on every button click.

Want to avoid the page reloading at every click. Also, I don't see the users going through every single record - they will be sitting there the whole day if they do that!

Maybe the second option will be more suitable. But then again, when I think it through, how about a drop down that when you select a user, a form gets generated and displays that user? That seems like the way forward. Can you help me with that? I imagine it will involve some js?

Member Avatar

A dropdown would certainly be easier, until you get to hundreds of options. Then you may go to an 'initial' paginator maybe or even a ajaxified autocomplete textbox which would display options matching what you type.

If you have a little think about what you want and have a go at some code, we'll certainly help you with it.

Best be prepared for the worst I think.
The autocomplete thing sounds the way to go forward. Will have a look for some code and see how far I get. Will give you a shout when I need to be rescued.

Member Avatar

Sorry I meant autosuggest not autocomplete !