Re: DB row selection
| From: | Hans Prins | Date: | Wed, 19 Feb 2003 14:40:16 +0000 |
| Subject: | Re: DB row selection | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136185@lists.php.net to get a copy of this message | ||
Thanks a lot guys, the feedback so far has been most usefull
Hans
"Joel Colombo" <joel@playoutloud.net> schreef in bericht
news:20030219100951.63626.qmail@pb1.pair.com...
> same thing....
>
> $query = "SELECT * FROM polls ORDER BY pollID DESC LIMIT 1";
>
> dont need both params for LIMIT. just the num of rows u want back works
too.
>
> Joel
>
>
> "Hans Prins" <HPrins@xgn.nu> wrote in message
> news:20030219100501.57961.qmail@pb1.pair.com...
> > That's weird.............. that was the first thing I tried (DESC), but
it
> > gave me a syntax error at runtime...... however, when I tried it now, it
> > worked..........
> >
> > I probably had another error that confused me.
> >
> > Thx a bunch :-)
> >
> > "Ernest E Vogelsinger" <ernest@vogelsinger.at> schreef in bericht
> >
> > news:5.1.1.6.2.20030219110047.0320a588@mail.vogelsinger.at...
> > > At 10:57 19.02.2003, you said:
> > > --------------------[snip]--------------------
> > > >Hello,
> > > >I recently learnt that with the code as stated below, I can select
one
> > row:
> > > >
> > > >$query = "SELECT * FROM polls ORDER BY pollID ASC LIMIT 0,1";
> > > >
> > > >However as far as I could figure out, I can only select the top row
or
> > tell
> > > >it at what rownumber to start and end. What if I wanted to select the
> > bottom
> > > >row? Would I have to do an extra query to count the rows and then
> select
> > it
> > > >with LIMIT?
> > > --------------------[snip]--------------------
> > >
> > > $query = "SELECT * FROM polls ORDER BY pollID DESC LIMIT 0,1";
> > >
> > >
> > > --
> > > >O Ernest E. Vogelsinger
> > > (\) ICQ #13394035
> > > ^ http://www.vogelsinger.at/
> > >
> > >
> >
> >
>
>