The LIMIT clause is not supported in the SELECT SQL subset of the VFP language.
As an alternative using the following code snippit, you can determine the offset, 0 or other integer, and the number of rows, 10 or other integer
$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
$numrows = isset($_GET['numrows']) ? $_GET['numrows'] : 10;
The following code returns the records detemined by the offset and number of rows
$Query = "SELECT company, street, town FROM contacts";
//execute query
$queryexe = odbc_do($connectionstring, $Query);
//query database
for ($cnt=0; $cnt<$numrows; $cnt++){
if ($cnt ==0) {
odbc_fetch_row($queryexe,$offset);
} else {
odbc_fetch_row($queryexe);
}
$company = odbc_result($queryexe, 1);
$street = odbc_result($queryexe, 2);
$town = odbc_result($queryexe, 3);
//format results
print ("<tr>");
print ("<td>$company</td>");
print ("<td>$street</td>");
print ("<td>$town</td>");
print ("</tr>");
}
In order to return the relevant records for a specific page, presumably, you need to create a function where you pass the offset and number of rows as parameters?
All contributions gratefully received. 🙂
Chris