Date: 04/14/00
- Next message: Christian Zagrodnick: "Re: [PHPLIB] Does PHPLIB work with PHP4 ?"
- Previous message: Kristian Koehntopp: "[PHPLIB] Re: Same databases"
- In reply to: Eric McKeown: "Re: [PHPLIB] $db->last_record() ???"
- Next in thread: Fabrizio Ermini: "Re: [PHPLIB] $db->last_record() ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
you will need to turn off auto free to or when u start at last record the
data will be released
My opinions are my own and not that of my employer even if I am self employed
On Thu, 13 Apr 2000, Eric McKeown wrote:
> Christof Beaupoil wrote:
>
> > next_record() of the DB_SQL class works fine. But how do I get the LAST
> > record?
>
> > None of those works? Why???
> >
>
> Try this:
>
> $last = $db->num_rows() - 1;
> $db->seek($last);\
>
> Warning: this is untested code.
>
>
> >
> > Is there any possible way of browsing backwards through the query
> > result?
> >
>
> I would try this:
>
> $num_rows = $db->num_rows();
> $last = $num_rows - 1;
>
> for ($i = $last - 1; $i >= 0; $i--) {
> $db->seek($i);
>
> $field_value = $db->f("fieldname");
> // Peform any desired processing here.
> }
>
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.
- Next message: Christian Zagrodnick: "Re: [PHPLIB] Does PHPLIB work with PHP4 ?"
- Previous message: Kristian Koehntopp: "[PHPLIB] Re: Same databases"
- In reply to: Eric McKeown: "Re: [PHPLIB] $db->last_record() ???"
- Next in thread: Fabrizio Ermini: "Re: [PHPLIB] $db->last_record() ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

