I am working with a Access Database and when I run the following code, it returns all records, instead of just the first 20.
<?php
//Connection statement
require_once('Connections/STATS.php');
// begin Recordset
$maxRows_Recordset1 = 20;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$MMsort__Recordset1 = 'asc';
if (isset($_GET['ord'])) {
$MMsort__Recordset1 = $_GET['ord'];
}
$MMname__Recordset1 = 'STATUS';
if (isset($_GET['str'])) {
$MMname__Recordset1 = $_GET['str'];
}
$query_Recordset1 = sprintf("SELECT * FROM BugTracking ORDER BY %s %s", $MMname__Recordset1,$MMsort__Recordset1);
$Recordset1 = $STATS->SelectLimit($query_Recordset1, $maxRows_Recordset1, $startRow_Recordset1) or die($STATS->ErrorMsg());
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = $STATS->SelectLimit($query_Recordset1) or die($STATS->ErrorMsg());
$totalRows_Recordset1 = $all_Recordset1->RecordCount();
}
$totalPages_Recordset1 = (int)(($totalRows_Recordset1-1)/$maxRows_Recordset1);
// end Recordset
//PHP ADODB document - made with PHAkt 2.6.2?>
However if I run the following code without the ORDER BY clause it works fine.
<?php
//Connection statement
require_once('Connections/STATS.php');
// begin Recordset
$maxRows_Recordset1 = 20;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$MMsort__Recordset1 = 'asc';
if (isset($_GET['ord'])) {
$MMsort__Recordset1 = $_GET['ord'];
}
$MMname__Recordset1 = 'STATUS';
if (isset($_GET['str'])) {
$MMname__Recordset1 = $_GET['str'];
}
//$query_Recordset1 = sprintf("SELECT * FROM BugTracking ORDER BY %s %s", $MMname__Recordset1,$MMsort__Recordset1);
$query_Recordset1 = sprintf("SELECT * FROM BugTracking"
$Recordset1 = $STATS->SelectLimit($query_Recordset1, $maxRows_Recordset1, $startRow_Recordset1) or die($STATS->ErrorMsg());
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = $STATS->SelectLimit($query_Recordset1) or die($STATS->ErrorMsg());
$totalRows_Recordset1 = $all_Recordset1->RecordCount();
}
$totalPages_Recordset1 = (int)(($totalRows_Recordset1-1)/$maxRows_Recordset1);
// end Recordset
//PHP ADODB document - made with PHAkt 2.6.2?>
Any ideas on what I can do?? Thanks!!
<?php
//Connection statement
require_once('Connections/STATS.php');
// begin Recordset
$maxRows_Recordset1 = 20;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$MMsort__Recordset1 = 'asc';
if (isset($_GET['ord'])) {
$MMsort__Recordset1 = $_GET['ord'];
}
$MMname__Recordset1 = 'STATUS';
if (isset($_GET['str'])) {
$MMname__Recordset1 = $_GET['str'];
}
$query_Recordset1 = sprintf("SELECT * FROM BugTracking ORDER BY %s %s", $MMname__Recordset1,$MMsort__Recordset1);
$Recordset1 = $STATS->SelectLimit($query_Recordset1, $maxRows_Recordset1, $startRow_Recordset1) or die($STATS->ErrorMsg());
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = $STATS->SelectLimit($query_Recordset1) or die($STATS->ErrorMsg());
$totalRows_Recordset1 = $all_Recordset1->RecordCount();
}
$totalPages_Recordset1 = (int)(($totalRows_Recordset1-1)/$maxRows_Recordset1);
// end Recordset
//PHP ADODB document - made with PHAkt 2.6.2?>
However if I run the following code without the ORDER BY clause it works fine.
<?php
//Connection statement
require_once('Connections/STATS.php');
// begin Recordset
$maxRows_Recordset1 = 20;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$MMsort__Recordset1 = 'asc';
if (isset($_GET['ord'])) {
$MMsort__Recordset1 = $_GET['ord'];
}
$MMname__Recordset1 = 'STATUS';
if (isset($_GET['str'])) {
$MMname__Recordset1 = $_GET['str'];
}
//$query_Recordset1 = sprintf("SELECT * FROM BugTracking ORDER BY %s %s", $MMname__Recordset1,$MMsort__Recordset1);
$query_Recordset1 = sprintf("SELECT * FROM BugTracking"
$Recordset1 = $STATS->SelectLimit($query_Recordset1, $maxRows_Recordset1, $startRow_Recordset1) or die($STATS->ErrorMsg());
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = $STATS->SelectLimit($query_Recordset1) or die($STATS->ErrorMsg());
$totalRows_Recordset1 = $all_Recordset1->RecordCount();
}
$totalPages_Recordset1 = (int)(($totalRows_Recordset1-1)/$maxRows_Recordset1);
// end Recordset
//PHP ADODB document - made with PHAkt 2.6.2?>
Any ideas on what I can do?? Thanks!!