Wrox Programmer Forums
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2004, 04:07 AM
Authorized User
 
Join Date: Apr 2004
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to junemo
Default pagination

Hi, I want craete a page that can list of record in html format. Let say the query may result in hundreds or thousands of records. Then, I need create button PREV and NEXT.

1. Isn't I need to create a procedure and run at SQL* Plus, i.e.

create or replace procedure paginate( p_start in number default 1)
as
    l_next boolean default false;
    l_pagesize number default 50;
begin
    htp.bold( 'p_start =' || P_start);
    htp.p('<table>');
    for x in (select *
                   from (select a.*, rownum r from bill a
                   where rownum <= p_start+l_pagesize) a
                   where r >= p_start)
loop
    l_next :=( x.r = p_start=l_pagesize);
    htp.p( '<tr><td>' || x.r || '</td><td>' ||
              x.invno || '</td></tr>');
end loop;
htp.p( '</table>');

if( p_start >1)
then
    htp.formOpen( 'paginate');
    htp.formHidden( 'p_start', p_start-l_pagesize);
    htp.formSubmit( cvalue => 'prev' || (p_start-l_pagesize));
    htp.formClose;
end if;
if(l_next)
then
    htp.formOpen( 'paginate');
    htp.formHidden( 'p_start', (p_start+l_pagesize));
    htp.formSubmit( cvalue => 'next' || (p_start+l_pagesize));
    htp.formClose;
end if;
end;
/

Are this code write in correctly? Do have duplicate record?

2. After I have create a procedure, how I want apply this in my application code(PHP)?
i.e.
<html>
.....
<?php
require_once("DB.php");
$connection = OCILogon("prod", "prod");
$stmt = OCIParse($connection, "SELECT * FROM ( SELECT a.*, rownum rnum
                FROM (SELECT invno FROM bill ORDER BY invno) a
                WHERE rownum < 50)
                WHERE rnum >= 1 ");
OCIExecute($stmt);
$rownum = OCIFetchStatement( $stmt, $results);
//display all entries
          for ( $i=0; $i<$rownum; $i++ )
    {
     echo " <td class=text8Arial11>&nbsp;" .$results["INVNO"][$i]."</td>";
              echo "</tr>";
            }
OCILogOff($connection);
?>
.....
</html>

3. Should I need create a button PREV and NEXT links in <html> tag?i.e.
<a href="javascript:doSubmit_prev();">Previous 50 Records</a>
<a href="javasrcipt:doSubmit_next();">Next 50 Records</a>

Then, where should I POST this form method each time I click the button NEXT / PREV?

Thanks in advance.

Oracle 8.1.7
PHP 4.3.4
Apache / IIS webserver
Win2000













Similar Threads
Thread Thread Starter Forum Replies Last Post
Pagination with checkboxes argan Pro JSP 2 November 28th, 2008 12:48 AM
Grouping and Pagination jayne XSLT 13 June 6th, 2007 01:52 AM
pagination problem solos XSLT 1 April 4th, 2007 05:40 PM
pagination Regornil Pro JSP 2 May 31st, 2005 06:10 AM
Please.....Pagination junemo PHP Databases 2 September 25th, 2004 01:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.