Let me be brief:
I am building a chat-style script that will (hopefully) allow people to add their own comments to an ever-growing datapile. The SELECT statement as it is written now will not be efficient enough to handle the size of the database unless I can optimize it.
Since this chat will allow people to add their own comments in a real-time way, I want to offer people the ability to select how many posts to display on the screen each time they update the page.
The PHP script also does not always append the new entries to the database. Sometimes they are prepended, sometimes inserted in the middle, etc.
1. How do I get MySQL/PHP to ONLY append new entries to the database (so they are in numerical order)?
2. How can I make MySQL reveal the largest value of the unique ID field?
From #2, I can then subtract the number of messages the user wants to scroll and then do a while {} statement to output only the final XX messages.
I have tried max(ID) and a couple of other things to address #2, but nothing seems to work. I always get a Resource ID #3 statement instead of a numeral.
Thanks in advance.
Jeff





Bookmarks