walkingdead Posted May 19, 2011 Posted May 19, 2011 Hi, I've just started learning PHP and just finished running through the Filemaker PHP API turorial. I'm trying to apply what I just learned to a custom website and I'm having some troubles connecting to my Filemaker Database. What I am trying to do is to get all records on a specific table to be displayed and I get the following error, "fatal error: call to a member function getField() on a non-object - on line 63" and I'm not sure where I went wrong. I'm sure its something simple as I am quite new to PHP. My php code is as follows: <?php $findcommand =$fm->newFinallCommand('Recipes'); $result = $findCommand->execute(); if (FileMaker::isError($result)) { echo "<p>Error: " . $result->getMessage() . "</p>; exit; } $record = $records[0] $recpipe = $record-getField('Recipe_Name'); ?> Thanks In advance for the help, Chris
Genx Posted May 20, 2011 Posted May 20, 2011 You're missing some code... You're not actually setting the $records variable anywhere. You might want to turn notices on in php to make this more obvious (http://php.net/manual/en/function.error-reporting.php). <?php $findcommand =$fm->newFindAllCommand('Recipes'); $result = $findCommand->execute(); if (FileMaker::isError($result)) { echo "<p>Error: " . $result->getMessage() . "</p>; exit; } // MISSING $records = $result->getRecords(); //End Missing[/size][/color] [color="#1C2837"][size="2"] $record = $records[0]; $recpipe = $record->getField('Recipe_Name'); ?>
walkingdead Posted May 20, 2011 Author Posted May 20, 2011 Awesome! Thanks Genx. Works like a charm. Thanks for the link too that should prove to be rather useful as I learn. Much appreciated, Chris
Recommended Posts
This topic is 5192 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 accountSign in
Already have an account? Sign in here.
Sign In Now