Skip 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.

Problem updating record using FMEdit

Featured Replies

  • Newbies

I'm attempting to update the number of times a Knowledge Base Article has been viewed when they click to view the article, however being new to using FX.php I can't seem to get this to work correctly. I would appreciate any insight and feedback on how to set this up correctly. Thank you in advance.

<?php

$kb_articles = $_GET['id'];

// Inialize session

session_start();

error_reporting (E_ALL ^ E_NOTICE);

define("DEBUG", false);

include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php");

include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/server_helpdesk.php");

$returncount = 1;

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

$query->SetDBData ("HelpDesk.fp5", "Main", "$returncount");

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

$query->AddDBParam('ID',$kb_articles,'eq');

$result = $query->FMFind();

?>

In the body section of the php page I have:

<?php

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

echo '<div id="popupevents">';

echo '<h2>Knowledage Base Article: '.$value['ID'][0].'</h2>';

echo '<table id="kba_table" cellspacing="0" summary="Knowledge Base Article Information" border="1">';

echo '<caption>Knowledge Base Article: '.$value['ID'][0].'</caption> ';

echo '<tr>';

echo '<th scope="col" abbr="Title" class="title" width="25%">Title:</th>';

echo '<td>&nbsp;'.$value['Title'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Category ID">Category:</th>';

echo '<td>&nbsp;'.$value['Category1'][0].', '.$value['Category2'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Summary">Summary:</th>';

echo '<td>&nbsp;'.$value['Summary'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Description">Description:</th>';

echo '<td>&nbsp;'.nl2br($value['Description'][0]).'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Creation Date">Creation Date:</th>';

echo '<td>&nbsp;'.$value['Creation_Date'][0].' by '.$value['Created_By'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Modification Date">Modification Date:</th>';

echo '<td>&nbsp;'.$value['Modification_Date'][0].' by '.$value['Modified_By'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Keywords">Keywords:</th>';

echo '<td>&nbsp;'.$value['Keywords'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Platform">Platform:</th>';

echo '<td>&nbsp;'.$value['Platform'][0].'</td>';

echo '</tr>';

echo '<tr>';

echo '<th scope="col" abbr="Operating System">Operating System:</th>';

echo '<td>&nbsp;'.$value['Operating_System'][0].'</td>';

echo '</tr>';

echo '</table>';

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

echo '<a href="javascript:window.close();">Close This Window</a>';

echo '</div>';

$viewcount = ++$value['Views'][0];

$queryadd = new FX($serverIP, $webCompanionPort);

$queryadd->SetDBData ("HelpDesk.fp5", "Main");

$queryadd->AddDBParam('-recid', $viewcount);

$queryadd->AddDBParam('Views', $viewcount);

$updateResult = $queryadd->FMEdit();

echo $viewcount;

}

?>

When I echo the $viewcount; it returns the correct value but the 'Views' field in the database isn't being adjusted. I'm sure I have something wrong in the italicized section. Again thanks for your help. -Ken

  • Author
  • Newbies

After doing some more research and experimenting with code I got it to work today. Here is the change that I made:

$recordPointers = explode ('.', $key);

$updateResult = $recordPointers[0];

$viewcount = ++$value['Views'][0];

$queryadd = new FX($serverIP, $webCompanionPort);

$queryadd->SetDBData ("HelpDesk.fp5", "Main");

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

$queryadd->AddDBParam('Views', $viewcount);

$queryadd->AddDBParam('-recid', $updateResult);

$updateResult = $queryadd->FMEdit();

Items in red have been added/modified. If anyone has an easier or cleaner way of doing this please let me know. Thanks.

-Ken

I usually call mine $recID so I know what it's for always, but that's the right idea...

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.