2016-09-27 58 views
0

我被困在一个我正在帮助的大型项目中 - 我们有一个FileMaker数据库,并且为它创建了一个在线目录。最初我们只穿了衣服,它运作得很好,但现在我们也添加了其他收藏。我正在努力制作下面显示的“C”(服装)系列,但它不起作用。我是FileMaker api的新手,非常感谢。用Filemaker api分隔类别/ php

<?php 

       /*the function that displays the buttons (the img) of each dress to link to the details page*/ 
       function displayRecords($records){ 
        /*TO DO*/ 
        foreach ($records as $record){ 
         $photo = $record->getField("Photo"); 
         $thumbnail = $record->getField("Thumbnail"); 
         $date = $record->getField("Date CR"); 
         $tNum = $record->getField("Catalog_Number"); 
         $category = $record->getField("Collection"); 

         if ($category = "C"){ 
          echo ("<div class=\"dimg\">"); 
          echo ("<a href = \"http://fadma.edu/historicalcollection/museum/details_test_textiles.php?id="); 
          echo($tNum); 
          echo ("\">"); 
          echo ("<img src= \" "); 
          echo ($thumbnail); 
          echo (" \"></a>"); 
          echo ("<div class=\"desc\">"); 
          echo ($date); 
          echo ("</div></div>");} 
        } 
       } 


       $begin = (int)$_GET["begin"]; 
       $end = (int)$_GET["end"]; 

       for ($x = $begin; $x <= $end; $x++){ 
        $findCommand = $fm->newFindCommand("Listing"); 
        $findCommand->addFindCriterion("Photo", "*"); 
        $findCommand->addFindCriterion("Date CR", $x); 
        $result = $findCommand->execute(); 
        if(FileMaker::isError($result)){ 
         continue; 
        } 
        $records = $result->getRecords(); 
        displayRecords($records); 
       } 


      ?> 
+0

有没有具体的错误? –

+0

不幸的是,不,只是一个404。双==做到了!多么愚蠢的事情要忘记。 – chauxvive

回答

2

我通常使用fx.php查询的Filemaker但看了一下您的代码后,你似乎有被过滤的结果如下:

if ($category = "C"){

但是单=是赋值运算符,而不是比较运算符。您需要检查$category是否等于C,而不是将$category设置为C

尝试使用if ($category == "C"){代替。请注意双==

+0

像CHARM一样工作,你很荣幸,谢谢! – chauxvive