Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

Hello,

today I tryed, to delet a record with the API.

I've read how the code has to be.

But in the line §cmd->setField the Script fails.

$fm = new FileMaker('DB', 'http://mac.equitania.net', 'user', 'passWord');

$cmd = $fm->newFindCommand('Layout');

$cmd->setField('Kategorie', 'Tests'); *Script fails

$cmd->setField('Aufgabe', 'Test Aufgabe');

$result = $cmd->execute();

if(FileMaker::isError($result)){

echo 'ERROR';

die();

}

$records = $result->getRecords();

$recordId = $records[0]->getRecordId();

$cmd = $fm->newDeleteCommand('Layout',$recordId);

$result= $cmd->execute();

if(FileMaker::isError($result)){

echo'ERROR2';

die();

}

Posted

I suspect that if it is failing at the first set field, then you're not really getting access to the database...

$fm = new FileMaker('DB', 'http://mac.equitania.net', 'user', 'passWord');

I think the db name requires the .fp7 extension, and I'd try just a host name rather than speccing the http protocol, and see if that gets you any further.

Also, it would be more useful if you isError actually gave you the error code back

if (FileMaker::isError($result)) {

echo 'Error: ' . $result->message . '(' . $result->code . ')';

die();

}

Posted

Please visit this link, it might be helpful to you

http://rsgss.co.in/RsgssForum/index.php?p=/discussion/4/deleting-record-using-fm-api

  • Newbies
Posted

@webko

I dont think thats the problem, because I used the same connection to add a record and read out records.

The error wont be given out, the script fails before this line.

Please visit this link, it might be helpful to you

http://rsgss.co.in/R...rd-using-fm-api

I'll try these thanks,

but when somebody knows how to get a specific record, like I tryed in my code, please tell me.

Posted

Please visit the following link, it might be helpful to you...

http://rsgss.co.in/RsgssForum/index.php?p=/discussion/4/deleting-record-using-fm-api

  • 4 weeks later...
Posted

Please nobody try to delete records like that... it's kind of like seeing an apple in a crate and unpacking the whole crate just to get to the apple you want.

Posted

Your line

$cmd->setField('Kategorie', 'Tests'); 


should be


$cmd->addFindCriterion('Kategorie', 'Tests');

Likewise with the line following.

--Doug

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