Put the record number into a hidden form element, then read it using $F() to
send it to your request...

Gareth


On 3/8/07, Aaron Roberson <[EMAIL PROTECTED]> wrote:
>
>
> @Christophe - I don't know if it wold be faster to load ten rows at a
> time into some XML and then display each pair of nodes one at a time
> or to just fetch each record from MySQL on every instance (XML is
> pretty cludgy, and MySQL is pretty fast). At this point I would just
> like to make it work, whether I put ten rows into XML or JSON or
> fetched each row from MySQL.
>
> @Gareth - I am very familiar with the LIMIT parameter in MySQL and
> would prefer this technique, but I don't know how to keep track of the
> last record retrieved so that I can increment the counter and then
> retrieve the following record when the link/button is clicked again.
>
> Here is my query (in ColdFusion):
>
> <cfquery name="getTestimony" datasource="berrettdb">
>                SELECT id, content, name
>                FROM testimony LIMIT #url.count#, 1;
> </cfquery>
>
> <cfoutput><p>#qTestimony.content#</p><cite>#qTestiomony.name#</cite></cfoutput>
>
> What that does is get the record starting at the number passed in and
> limiting it to just that one record. Then I output that one record's
> content in paragraph tags and the name in cite tags. When this is
> returned, it will replace everything between <blockquote
> id="testimony"></blockquote>.
>
> I also have a query that returns the total number of records in the
> table. Here it is in ColdFusion:
>
> <cfquery name="getTestimonies" datasource="berrettdb">
>        SELECT id
>        FROM testimony
> </cfquery>
>
> Before I output the content from the table record I can check if the
> number passed in is greater than (using GT in ColdFusion) the record
> count. If it is, I can set the count variable back to one so that the
> first testimony record will be output again (effectively rotating
> through the testimonies instead of displaying a previous and next link
> and worrying about hiding one or the other if we are at the first or
> last record). Here is how that is done:
>
> <cfif url.count GT getTestimonies.recordCount>
>         url.count = 1
> </cfif>
>
> THE ONLY PROBLEM is that I don't know how to pass number of count back
> to the calling page with a value of count + 1 and then take that and
> pass it back to my getData page so I can get the next record when the
> link is clicked again. How do I "maintain state" between my getData
> page and my view page?
>
> @Maninder - I have poured over that article on particletree.com and I
> cannot seem to parse it all out and apply the principles to my
> situation.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to