Thread: limit
How come
$query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc limit 0,10";
Does not display any posts in my news script, but
$query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc limit 10";
Shows the last 10.?
And:
How come
$query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc limit 10,20";
Displays posts 5 to 14, and not 10 to 20?!
Regards
Paul Ottar Tornes
Paul Ottar Tornes wrote: > This is a multi-part message in MIME format. > > ------=_NextPart_000_00B3_01C2813F.1EFB1790 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > How come=20 > $query =3D "SELECT id, tittel, dato, kilde, referat FROM nyheter > order = > by id desc limit 0,10"; > Does not display any posts in my news script, but > $query =3D "SELECT id, tittel, dato, kilde, referat FROM nyheter > order = > by id desc limit 10"; > Shows the last 10.? > > And: > > How come > $query =3D "SELECT id, tittel, dato, kilde, referat FROM nyheter > order = > by id desc limit 10,20"; > Displays posts 5 to 14, and not 10 to 20?! > > Regards > > Paul Ottar Tornes > > ------=_NextPart_000_00B3_01C2813F.1EFB1790 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > > > > > > > How come > > $query =3D "SELECT id, = > tittel,=20 > dato, kilde, referat FROM nyheter order by id desc limit 0,10"; > > Does not display any posts in my news scri= > pt,=20 > but > > $query =3D "SELECT id, = > tittel,=20 > dato, kilde, referat FROM nyheter order by id desc limit 10"; > > Shows the last 10.? > > > > And: > > > > How come > > $query =3D "SELECT id, = > tittel,=20 > dato, kilde, referat FROM nyheter order by id desc limit 10,20"; > Displays posts 5 to 14, and not 10 to=20 > 20?! > > > > Regards > > > > Paul Ottar Tornes > > > ------=_NextPart_000_00B3_01C2813F.1EFB1790-- > > You must use the OFFSET to do this. Write your query this way: $query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc offset 9 limit 10";