Jump to content

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

Recommended Posts

Posted

OK, I know I saw something posted on this before but cannot find it...

I am trying to get a found set that includes 3 specific publications using CatalogNumber as the search field.

My code:

$hotsearch=new FX($serverIP,$webCompanionPort);

$hotsearch->SetDBData('Pub_Publication_.fp5','ForPHP');

$hotsearch->AddDBParam('CatalogNumber', $hotpub1);

$hotsearch->AddDBParam('CatalogNumber', $hotpub2);

$hotsearch->AddDBParam('CatalogNumber', $hotpub3);

$hotsearch->AddDBParam('-lop', 'or');

$hotsearchResult=$hotsearch->FMFind();

foreach($hotsearchResult['data'] as $hot2=>$hotdata2);

This will only find one record (the last one).

In filemaker I can use the "addition request" to add more parameters to the find using the same field.

Any help is always appreciated.

Posted

I've worked with someone recently who has a similar problem. However, I was able to get it to work on my combination of software.

I am using FM6 with FX 4.

Here is a way of testing:

$findrecord->AddDBParam("Info_ID","102 104 105");

findrecord->AddDBParam("-lop","or");

$findrecordResult=$findrecord->FMFind();

This just has a list of search criteria as a space-delimited string. However, multiple AddDBParam should also work.

Good Luck.

Garry

Posted

I'll give it a try,

I wonder if there is a difference between ' and " in the code.

I noticed for '-script' that when I used ("-script", "placeorder") it magically worked, while the single quote gave problems.

I'll let you know how it goes - because logically, my code should be clean.

FM 6 and FX 4.02 on Windows 2000 apache 2, php 4.5

Posted

Gary,

I played around with a few combinations and watch what happend in the FM database. It appears that all three records were appearing and that the key was where I was placing my 'foreach' statement.

I also made sure that I used doublequotes ( " ) instead of single quotes.

Here is the final working code for reference:


$hotsearch=new FX($serverIP,$webCompanionPort);

$hotsearch->SetDBData('Pub_Publication_.fp5','ForPHP');

$hotsearch->AddDBParam("CatalogNumber", "25570");

$hotsearch->AddDBParam("CatalogNumber", "4633");

$hotsearch->AddDBParam("CatalogNumber", "25648");

$hotsearch->AddDBParam("-lop", "or");

$hotsearchResult=$hotsearch->FMFind();




The in the html I added this code:





Popular Picks

<? foreach($hotsearchResult['data'] as $hot2=>$hotdata2) {?> [*]<? echo $hotdata2['Title'][0];?> <? }?> [/list]




And finally a very useful bit of code for checking where the data was ending up was:




 print "
-";
print_r($hotsearchResult); print "-";

This helped located the missing recorded and proved that in fact they might have been there all along, but the foreach statement needed to be correctly used.

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