[thelist] php display 3x2

Jason Bauer jbauer_23 at yahoo.com
Tue Dec 3 13:12:01 CST 2002


--- Howard Cheng <howcheng at ix.netcom.com> wrote:
> At 05:01 PM 12/3/2002 +0000, Andrew Maynes wrote:
> >$sql = "SELECT ... FROM ... ORDER BY ... LIMIT " .
> ($page - 1 * 3) . ", 6";
>
>
> Oops, I left out a set of parentheses. This should
> have been:
>
> (($page - 1) * 3)
>
> The LIMIT clause in MySQL takes two parameters, the
> starting record number
> and the number of records to retrieve. So to get the
> first six, you want
> "LIMIT 0,6". That's why you need to subtract 1 from
> your page number.

That won't work properly... If you are on page 2, you
will get records 3 - 9, page 3 will get 6-12, etc.

You really want (($page - 1) * 6)

---
Jason Bauer
jbauer_23 at yahoo.com
Chimes, Inc.
Web Developer

=====
---
Jason Bauer
jbauer_23 at yahoo.com

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list