Jump to content

Use FX to create multiple find request (And/Or)


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

Recommended Posts

Hi there, i just want to ask how can i create a multiple(And/Or) find request by using PHP FX. For example the find request , A and B or C. It is very easy to do it in Filemaker, but in PHP with using FX, i only can perform one type, either all "And" or all "Or", eg. A and B and C / A or B or C

Hope someone can help me. Thanks for helping.

Regards,

Henry

Link to comment
Share on other sites

Hi Henry, you can't do this directly in a single call to FileMaker; Web Companion simply doesn't support it. However, using PHP and FX there is an excellent alternative - make two separate calls to the database, store the results from each separately, then merge the data portions of the results using PHP's merge_array() function. Here is an example:


<?

require_once("FX/FX.php");

$query = new FX("127.0.0.1", "591"); 

 

// Search in Book_List.fp5

//

$query->SetDBData("Book_List.fp5", "Detail_View");

$query->AddDBParam("author", "bowers");

$result_1 = $query->FMFind(); 

 

// Search in Book_List_part_2.fp5

//

$query->SetDBData("Book_List_part_2.fp5", "Detail_View");

$query->AddDBParam("author", "bowers");

$result_2 = $query->FMFind();

 

// Merge the results

//

$result_1["data"] = array_merge($result_1["data"], $result_2["data"]); 

 

// Output the results

//

print "<table border=1 cellpadding=1 cellspacing=1>n";

foreach ($result_1["data"] as $row) {

   print "<tr><td>".$row["author"][0]."</td><td>".$row["title"][0]."</td></tr>n";

}

print "</table>n";

?>

Link to comment
Share on other sites

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