February 14, 200521 yr Hi, I am trying to add a new record to FM 7 using FX. The new record is added; however, the returned data set has no data. It is supposed to have the values of the just created record. Here is my code: $result=$NewData->FMNew(); $recKey = key($result['data']); $recordPointers = explode (".",$recKey); $recID = $recordPointers[0]; RecID is null. Any ideas will be very appreciated! Thank you very much
February 14, 200521 yr Try to print the Array to see if it is anywhere else: print_r($result); Good Luck. Garry
February 14, 200521 yr Author That what it looks like: fx_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 => 100 [message] => FX: ExecuteQuery XML error: no element found at line 1 [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => /Library/WebServer/Documents/SSD_new/include/FX.php [line] => 879 [function] => fx_error [class] => fx_error [type] => -> [args] => Array ( [0] => ExecuteQuery XML error: no element found at line 1 ) ) [1] => Array ( [file] => /Library/WebServer/Documents/SSD_new/include/FX.php [line] => 1041 [function] => executequery [class] => fx [type] => -> [args] => Array ( [0] => -new ) ) [2] => Array ( [file] => /Library/WebServer/Documents/SSD_new/include/FX.php [line] => 1107 [function] => fmaction [class] => fx [type] => -> [args] => Array ( [0] => -new [1] => 1 [2] => full ) ) [3] => Array ( [file] => /Library/WebServer/Documents/SSD_new/new_ticket.php [line] => 34 [function] => fmnew [class] => fx [type] => -> [args] => Array ( ) ) ) [callback] => ) Does it tell you about anything? Thank you very much for your help!
February 17, 200521 yr Here is what a basic - create a new record should look like: $newrecord=new FX($serverIP,$webCompanionPort); $newrecord->SetDBData('Order.fp5','ForWeb'); $newrecord->AddDBparam('OrderID', ''); $newrecordResult=$newrecord->FMNew(); foreach($newrecordResult['data'] as $key=>$newrecordData); $recordDetails = explode('.',$key); $currentrecord=$recordDetails[0]; Then I might set a cookie: setcookie("orderID", $currentrecord, time()+60*60*24,"/"); This could also be done with sessions. Hope this helps - but also consider FXForge from the people at FMWebschool (FXforge.net)
February 21, 200521 yr Author I am working with FM 7. Anyways - tried that. It looks like it does not return data only if I am using particular layouts. If I use layout that contain ONLY fields from this database - it returns data. If I use layout that contains fields from related db's - it does not. User names and passwords are identical for all the related databases. Also, if the record is being created - I can't see it via FMPXMLRESULT link using layouts other than the one that was used to create it. I've spent so much time trying to figure this out and I am getting really frustrated...: Please help....
February 22, 200520 yr having not seen your whole code, can't check to see what you might have missed. I just went through a similar problem and was missing: $newrecord->SetDBPassword($db_password); //$db_password is defined in fx_server.php The other steps - which you have have done - are to reduce the number of fields you are trying to create in the new record and see if you can get one field to work. Also looking at your array you printed, there appear to be some files missing or errors in your coding. Check line 34 of new_ticket.php If you are having huge frustrations, I'm sure there are many coding experts that for an hours worth of billable time could review in detail your files and make the corrections necessary.
Create an account or sign in to comment