MySQL has a function similar to T-SQL (microsoft) TOP which is actually more thought out. It is called LIMIT. It takes 2 comma seperated numbers, a start record, and an end record (though that could be length, i dont use mysql much)
So in your "getdata" page, you'll want to run your SQL query and use LIMIT X,1 (or X,X+1 if it's end row, rather than length) Where X is a value passed into getdata. So passing it on the query string you'd go : getdata.[aspx|php|asp|*] ? key=value and then ensure it is numeric data (sql injection prevention) and send it into your query to get your one record. Since you've only got 3 columns of data, i'd be tempted to just return a hash-style string, eg: Id=<value>&Name=<value> etc and then when you get your response using a Ajax.Request(url,...) in your handler for the onSuccess, you can use the string-to-hash function (sorry can't remember the name) to convert the string of key=value pairs into something you can reference using hash[key]) You would probably also need to return the count of records that are available, so you can hide the next link when you are on the last record. The next link would just make a new call to get new data with X + 1 Anyway, very brief overview, i'm not going to attempt to go into any more detail. On 3/7/07, Christophe Porteneuve <[EMAIL PROTECTED]> wrote: > > > Hey Aaron, > > Aaron Roberson a écrit : > > I have a MySQL database with a table named "tesimony" which has three > > feilds (id [int 11 autonumber], content [text], name [varchar 75]. How > > can I display one row at a time with a link to rotate out the current > > row with the next row? > > Well, first, what about the loading strategy? In your situation, do you > think it is best to do one XHR per record (with possible UI latency, > then), or to fetch larger resultsets (e.g. 10 records at a time)? > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: [EMAIL PROTECTED] > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
