Get sum of column using FM PHP Api

Discussion created by johnny83 on Jan 11, 2017
Latest reply on Jan 18, 2017 by johnny83

I have a tablo as shown below.



I can print 40 when using this sql query:


SELECT SUM (People) FROM "Booking" WHERE TourDate = 3/01/2017


I want to get sum of the column "People" using FM PHP Api. So far I have written this:


$date = "3/01/2017"; 
$fm = new FileMaker('filename', 'hostname', 'admin','passw0rd');
$findCommand = $fm->newFindCommand("Bookings"); 
$findCommand->addFindCriterion("TourDate", $date); 
$result = $findCommand->execute(); 
$records = $result->getRecords(); 


First time I am using FM PHP Api. I don't know how to proceed from here. I would appreciate any suggestion. Thanks.