Jump to content

Fatal Error


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

Recommended Posts

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

Link to comment
Share on other sites

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');



?>

Link to comment
Share on other sites

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