Forums

Pagination

rohit 22 Apr, 2008
I am using the following code - my default seting of 5 rows per page works but when I change the setting to 10 I see the first page okay and on clicking the NExt link - I see 'You are not allowed to access this URL directly, POST array is empty'

I am simply trying to paginate my query results.

I am using the following code in both - Form HTML and On SUbmit
Please help.

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("joomla15", $con);

$limit = intval( mosGetParam( $_REQUEST, 'limit', 0) );
$limitstart = intval( mosGetParam( $_REQUEST, 'limitstart', 0) );

$query = "SELECT COUNT(*) FROM jos_chronoforms_1 where Category like 'zoos'";
$database->setQuery( $query );
$total = $database->loadResult();

$limit = $limit ? $limit : 5;
if ( $total <= $limit ) {
$limitstart = 0;
}

require_once( $GLOBALS['mosConfig_absolute_path'] . '/includes/pageNavigation.php' );
$pageNav = new mosPageNav( $total, $limitstart, $limit );


$database->setQuery( $result, $limitstart, $limit );

$query = "SELECT `name`, `address`, `state` FROM jos_chronoforms_1 where Category like 'zoos'";
$database->setQuery( $query, $limitstart, $limit );

$rows = $database -> loadObjectList();

for( $i=0; $i<count($rows); $i++ )
{
$row = $rows[$i];
echo $row->name." / ".$row->address." / ".$row->state."<br>";
}


echo $pageNav->getLimitBox($link);
echo $pageNav->writePagesLinks($link);
echo $pageNav->writePagesCounter();



mysql_close($con);
?>
GreyHead 22 Apr, 2008
Hi Rohit,

Possibly when you use it from the OnSubmit page there is no $_POST array so you trigger the spam protection.

Try using the showform format I just posted in reply to your other query.

Bob
rohit 22 Apr, 2008
Hey I tried including the
showform($_POST);
in the on submit code but it would still show the same message on clicking Next in the pages links.
rohit 22 Apr, 2008
Hey it works well on rows per page=5
only i am unable to get it to work with another value I pick from the dropdown.
GreyHead 22 Apr, 2008
Hi Rohit,

I don't know what's happening here, haven't got time to look right now but I will add it to my list to check out.

Bob
rohit 25 Apr, 2008
Hey Bob, I will immensely appreciate any help I can get with this. Please respond.

Thanks
Rohit
This topic is locked and no more replies can be posted.