Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Can't get FMSkipRecords to work correctly

Featured Replies

  • 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

Well, you've only ever said $skip = 0 - you'll need to pull the skip value from your LinkNext / LinkPrevious links

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.