how will i set pagination ?

Answer Posted / rajkumar (rk)

This is the oracle pagination for PHP script... We need to include this in our PHP

<?
$lv_pages = OCIParse($con, $lv_qry);
OCIExecute($lv_pages);
while (OCIFetch($lv_pages))
{
$total = $total+(OCINumCols($lv_pages)-1);
}

$lv_start_rec = $_SESSION['lv_start_rec'];
$lv_end_rec = $_SESSION['lv_end_rec'];
if($_POST['lv_flag']!='')
{
if($_POST['lv_flag']=='1')
{
$lv_first_rec = 1;
$lv_last_rec = 10;
}
if($_POST['lv_flag']=='2')
{
if($lv_start_rec == 1 && $lv_end_rec == 10)
{
$lv_first_rec = 1;
$lv_last_rec = 10;
}
else if($lv_start_rec >= 1 && $lv_end_rec <= 10)
{
$lv_first_rec = 1;
$lv_last_rec = 10;
}
else
{
$lv_first_rec = $lv_start_rec - 10;
$lv_last_rec = $lv_start_rec - 1;
}
}
if($_POST['lv_flag']=='3')
{
if($lv_start_rec == ($total-10) and $lv_end_rec == $total)
{
$lv_first_rec = $total-10;
$lv_last_rec = $total;
}
else if($lv_end_rec >= $total)
{
$lv_first_rec = $lv_start_rec;
$lv_last_rec = $lv_end_rec;
}
else
{
$lv_first_rec = $lv_start_rec + 10;
$lv_last_rec = $lv_end_rec + 10;
}
}
if($_POST['lv_flag']=='4')
{
if ($total <= 10)
$lv_first_rec = 1;
else if (($total%10) == 0)
$lv_first_rec = $total - 10+1;
else
$lv_first_rec = $total - ($total%10) +1;

$lv_last_rec = $total;
}
}
else
{
$lv_first_rec = 1;
$lv_last_rec = 10;
}

$_SESSION['lv_start_rec'] = $lv_first_rec;
$_SESSION['lv_end_rec'] = $lv_last_rec;

?>

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to track user logged out or not? When user is idle?

516


What is a php form?

546


What are the features and advantages of object-oriented programming in php?

492


What are the functions to be used to get the image's properties (size, width and height)?

549


Which function will you use to create an array?

520






What is php data type?

527


What is null value in php?

573


What is sticky form in php?

501


What is memcache?

548


Can we override static method in php?

539


Is echo a function in php?

519


How can we submit from without a submit button?

582


How to select a database in php?

581


What are global variables in php?

504


Explain about the $_GET variable of PHP?

584