Have you checked how many records your request is finding?
echo 'Found '. count($records) . " results.";
Run that out and see how many, if it's 1 then your foreach loop is fine and you need to look at your find request. If it's more than one, chances are you've got an issue in the way you're parsing out your returned array.
I don't see anything wrong with your logic, it looks like you followed the example out of the CWP guide:
The only thing I see missing is:
right before you close your loop. It's in the CWP examples but not in your script above.
The code does not have any Find criteria...
Try changing the $record variable to $event or $carrot or something else in case I missed the plural vs singular record.
What about this layout "eventsPHX"... is it a base table with native records?
WOOPS!!! I saw that the first time then missed the second time that you wrote newFindAllCommand..... Sorry.
I thought that getRecords() returns an array of "record objects" for all of your found records?
in the CWP guide:
Processing the records in a result set
1 Retrieve an array containing each record in the result set by calling the getRecords()
method. Each member of the array is a FileMaker_Record object, or an instance of the class name set in the API for instantiating records. The array may be empty if the result set contains no records.
I think Sanjay said he was getting a rendered result, but just one record, not all records. That makes me suspect his loop more than the find. I don't think he is being returned an empty array, which would indicate a find issue.
Ah well, I don't do nearly enough CWP to know for sure though, so Sanjay, please consider Lyndsay's advice as well.
And just saw your whoops comment. ^_^;