Donn wrote: >this question seems to be unrelated to perl but merely sql. > >but i am generating a web page displaying the data >from oracle db, using perl script..i have one problem though >with my SQL.. > >can somebody pls. help me with sql on how >to page the resultset from a select query... >say page 1 contains first 1-100 rows, page 2 is 101-200 rows...and so on. > >i need to make a page toolbar with links to each page >in a resultset similar to this: > ><FIRST><NEXT> 1 2 3 4 5 6 7 8 9 <PREVIOUS><LAST> >
Actually it's quite easy. For selecting data from a database use a statement like: SELECT ... FROM ... ORDER BY ... LIMIT x,y; where x is the number of the first row you want to select, and y is the number of selected rows. Then in each link of your toolbar (first, next, 1, 2, ...) you just have to tell your script what x actually is, like: <A HREF="script.cgi?parameter1=somethin¶meter2=something&x=0">FIRST</A> <A HREF="script.cgi?parameter1=somethin¶meter2=something&x=30">NEXT</A> <A HREF="script.cgi?parameter1=somethin¶meter2=something&x=0">1</A> .... <A HREF="script.cgi?parameter1=somethin¶meter2=something&x=80">9</A> <A HREF="script.cgi?parameter1=somethin¶meter2=something&x=20">PREVIOUS</A> <A HREF="script.cgi?parameter1=somethin¶meter2=something&x=80">LAST</A> x-es for first, last and numbers 1-9 (unless of cours the nmber of rows changes) are static, but the perl scripts, which produces this page, must calculate x-es for next and previous. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]