Jump to content
Server Maintenance This Week. ×

Can't get FMSkipRecords to work correctly


This topic is 4463 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I'm attempting to use a form to allow users to narrow/filter results when searching our tech request system because we have quiet a few entries in our database. I'm hoping to return 15-20 requests per page and allow the user to use the FMSkipRecord feature to navigate through their returned results sorting the returned results by date/time modified. However when I perform a search that yields more than 15 results and click "next" the page loads a records found: 0, Displaying Records 1 through 0 result.

Here is the code:

<?php

// Inialize session

session_start();

// Value(s) from search_request.php

$completed = $_POST['completed'];

$database = $_POST['database'];

$lastname = $_POST['lastname'];

$description = $_POST['description'];

$school = $_POST['school'];

$problem = $_POST['problem'];

$assigned = $_POST['assigned'];

//Find number of records to skip and set Groupsize

if (! isset($skip) || $skip == '') {$skip = 0;}

if (! isset($FXE_groupSize) || strlen(trim($FXE_groupSize)) == 0) $FXE_groupSize = 15;

$query = new FX($serverIP, $webCompanionPort, $dataSourceType);

$query->SetDBData ("$database", "Main", "$FXE_groupSize");

$query->FMSkipRecords($skip);

$query->SetDBUserPass ($webUN, $webPW);

$query->AddDBParam('Completed?', $completed,'eq');

$query->AddDBParam('Last', $lastname, 'cn');

$query->AddDBParam('Description', $description,'cn');

$query->AddDBParam('School', $school,'eq');

$query->AddDBParam('Type', $problem,'eq');

$query->AddDBParam('Assigned_to', $assigned,'eq');

$query->AddSortParam ('Date Modified','descending'); // Sort by Date Modified

$query->AddSortParam ('Time Modified','descending'); // Sort by Time Modified

$result = $query->FMFind();

$records = $result['data'];

?>

In the HTML body:

<?php

echo '<p class="indent">Records Found: ' .$result['foundCount'].'</p>';

echo '<p class="indent">Displaying Records ' . ($skip + 1) . ' through ' . min(($skip + $FXE_groupSize), $result['foundCount'].'</p>');

echo '<br />';

if (strlen($result['linkPrevious']) < 1) {echo "<span class="medgraytext">Prev</span>n";}

else {echo '<a href="'.$result['linkPrevious']."" class="bbody">Prev</a>n";}

if (strlen($result['linkNext']) < 1) {echo "<span class="medgraytext">Next</span>n";}

else {echo '<a href="'.$result['linkNext']."" class="bbody">Next</a>n";}

foreach ($result['data'] as $key => $value) {

// Begin the Search Table

echo '<table id="Searchtable" cellspacing="0" summary="">';

echo '<caption>Job Priority: '.$value['Priority'][0].'</caption>';

echo '<tr>';

echo '<th scope="col" width="8%" abbr="Job Code" class="title">Job #</th>';

echo '<th scope="col" width="25%" abbr="Submitted By" class="header">Submitted By</th>';

echo '<th scope="col" width="25%" abbr="School" class="header">School - Location</th>';

echo '<th scope="col" width="20%" abbr="Problem" class="header">Type of Problem</th>';

echo '<th scope="col" width="22%" abbr="Equipment" class="header">Equipment</th>';

echo '</tr>';

echo '<tr>';

echo '<td class="start">'.$value['Job_Code'][0].'</td>';

echo '<td>'.$value['First'][0].' '.$value['Last'][0]. ' - '.$value['Phone'][0].'</td>';

echo '<td>'.$value['School'][0]. ' - '.$value['Location'][0].'</td>';

echo '<td>'.$value['Type'][0].'</td>';

echo '<td>'.$value['Machine_Type'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<td colspan="5" class="description"><span class="submitted">On '.$value['Date submitted'][0].' '.$value['First'][0].' Wrote: </span><br /> '.$value['Description'][0].'<br /><br /><span class="techassigned">Currently Assigned to:</span> '.$value['Assigned_to'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<td colspan="5" class="comments" >'.nl2br($value['Comments'][0]).'</td>';

echo '</tr>';

echo '<p class="minispace"></p>';

}

echo '</table>';

?>

It finds the right number of records to begin with i.e., it will state records found 20, displaying 1 through 15 records, however it just won't advance/backup any additional records. Thank you. Ken

Link to comment
Share on other sites

This topic is 4463 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.