1

表包含 1304 条记录,但在运行下面给出的脚本后,它仅显示最后一条记录 1304 次。所以请帮助我。是否可以从 filemaker 获取多条记录,我不知道。

<?php include ("dbaccess.php");?>
<?php
//Create the 'find all' command and specify the layout
$findCommand = $fm->newFindAllCommand('eventsROY');
//Perform the find and store the result
$result = $findCommand->execute();

        //Check for an error
        if (FileMaker::isError($result)) {
            echo "<p>Error: " . $result->getMessage() . "</p>";
            exit;
        }
   //Store the matching records
        $records = $result->getRecords();
//print_r($records);
        echo $cnt =  count($records);
    foreach($records as $rc){

       $time = $rc->getField('time');echo "<pre>";
print_r($time);
echo "<pre>";
}
?> 
4

1 回答 1

1

这个问题太老了,所以我不确定它是否仍然是一个问题,但如果是,也许我可以提供帮助。

您的布局布局上的字段是什么样的eventsROY?更重要的是,它们都是来自布局的本机表出现,还是其中一些,time特别是来自不同的相关表?

你的结构是正确的。我在这里稍微清理了一下:

<?php 
include ("dbaccess.php");

//Create the 'find all' command and specify the layout
$findCommand = $fm->newFindAllCommand('eventsROY');

//Perform the find and store the result
$result = $findCommand->execute();

//Check for an error
if (FileMaker::isError($result)) {
    echo "<p>Error: " . $result->getMessage() . "</p>";
    exit;
}

//Store the matching records
echo $count = $result->getFetchCount();

foreach($result->getRecords() as $record){

    $time = $record->getField('time');

    echo "<pre>";
    print_r($time);
    echo "<pre>";
}

?> 

因此,如果您从eventsROY表中获得期望的记录数,则意味着查询正在工作,如果您从时间字段中获得值(即使它是错误的),则意味着该字段在eventsROY布局上可用.

我可以看到这种反复提取相同time值的方式是,如果时间是相关表中的一个字段,并且该相关表的关系对表中的每条记录使用相同的相关记录eventsROY。例如,如果您有一个schedule通过eventsROY笛卡尔连接(价值。Xschedule::timeeventsROYschedule

你应该做的是解决这个问题:

  • 转到eventsROYFileMaker 中的布局,查看该time字段是来自eventsROY表还是其他相关表
  • 如果它来自eventsROY表并且是计算,请确保计算是从eventsROY表事件中评估的(如果它是从可能导致问题的不同 TO 评估的)
  • 回到您的 php 中,尝试使用 aprint_r($record)代替您的print_r($time)just 以确保您的其余字段也返回预期的响应
于 2014-12-20T13:02:32.417 回答