Jump to content
Server Maintenance This Week. ×

FM12 Server Advanced not editing/changing records


niro

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

Recommended Posts

  • Newbies

Hello,

 

We use FM11 Server Advanced to host several databases, and use php extensively. This works perfect. But we want to upgrade to FM12 Server Advanced. Every php script that should edit the content of a field doesn't work. We can read/display the contents of fields, add records, delete records, but, strange enough, not change field contents.

 

The code below does not change the contents of any of the fields mentioned. It seems to do nothing, and end with, when made visible php strict errors, and calling the isError function 'should be called statically'.

 

Hardware: Mac mini, new (our test server) running MacOS 10.8.5 with Server 2.2.2 and FM12 Advanced Server 12.0.4. Using FM Pro 12 client works fine. 

 

My question, what's wrong with the code used?

 

 

<?php
# For security reasons, these lines should be
# included from a file above the web directory
require_once ('../../private_casper/'.$_REQUEST['sist'].'.php');
 
# this is the include for the API for PHP
require_once ('FileMaker.php');
 
# instantiate a new FileMaker object
$fm = new FileMaker(FM_FILE, FM_HOST, FM_USER, FM_PASS);
 
# initialize message var for output below
$message = '';
$layout = 'casper_mumc_orig';
 
# check the POST array to see what action to take
if (isset($_POST['action']) and $_POST['action'] == 'Save changes') {
# edit the record
$edit = $fm->getRecordByID($layout, $_POST['recid']);
 
$edit->setField('STROKEdag', $_POST['STROKEdag']);
$edit->setField('STROKEmnd', $_POST['STROKEmnd']);
$edit->setField('STROKEjr', $_POST['STROKEjr']);
$edit->setField('STROKE_CORT', $_POST['STROKE_CORT']);
$edit->setField('STROKE_CORT_LOC', $_POST['STROKE_CORT_LOC']);
$edit->setField('STROKE_AND', $_POST['STROKE_AND']);
$edit->setField('STROKE_LAC', $_POST['STROKE_LAC']);
$edit->setField('STROKE_LAC_LOC', $_POST['STROKE_LAC_LOC']);
$edit->setField('STROKE_CEREBEL', $_POST['STROKE_CEREBEL']);
$edit->setField('STROKE_CEREBEL_LOC', $_POST['STROKE_CEREBEL_LOC']);
$edit->setField('STROKE_MINS', $_POST['STROKE_MINS']);
$edit->setField('STROKE_MINS_LOC', $_POST['STROKE_MINS_LOC']);
$edit->setField('STROKE_SUBCORT', $_POST['STROKE_SUBCORT']);
$edit->setField('STROKE_SUBCORT_LOC', $_POST['STROKE_SUBCORT_LOC']);
$edit->setField('STROKE_WATER', $_POST['STROKE_WATER']);
$edit->setField('STROKE_WATER_LOC', $_POST['STROKE_WATER_LOC']);
 
$edit->setField('FAM_DEM', $_POST['FAM_DEM']);
$edit->setField('FAM_DEPR', $_POST['FAM_DEPR']);
$edit->setField('FAM_HART', $_POST['FAM_HART']);
$edit->setField('FAM_AND', $_POST['FAM_AND']);
$edit->setField('FAM_GEEN', $_POST['FAM_GEEN']);
$edit->setField('FAM_ANAM', $_POST['FAM_ANAM']);
 
$result = $edit->commit();
  if (FileMaker::isError($result)) {
    $error_code = $result->code;
    die ('<html><head><title>Error</title><link href="casper_style.css" rel="stylesheet" type="text/css" media="all"></head><body><br><br><center><table width=500><tr><td align="middle">' . $result->getMessage() . ' (error ' . $result->code . ') </td></tr></table><br><br><form><input type=button value="Terug naar vorige pagina" onclick=history.go(-1);return false; /></form></center></body></html>');
  }
  # update the message var for output below
  $message = '<center><table cellpadding=5><tr><td align=middle><b>De gegevens zijn bewaard</b><br><br><br><form><input type=button value="Terug naar vorige pagina" onclick=history.go(-1);return false; /></form></td></tr></table></center>';
}
# make sure there is a recid
if (empty($_REQUEST['recid'])) {
    die('The record id is missing.');
}
?>
 

 

 

Link to comment
Share on other sites

I ran into a similar problem when I upgraded to 12, and found that I had just copied the FileMaker 11 API files along with my other php files.  Replacing those with the FM 12 API files solved the problem.

Link to comment
Share on other sites

  • Newbies

Hi doughemi, this is a brand new Mac, with MacOSX 10.8, so there are no previous installs, everything is new and updated to the last. I already installed the PHP API again, manually, just to be sure it's complete. Still can't edit records. 

Link to comment
Share on other sites

This topic is 3826 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.