Jump to content

Storing filemaker results in PHP session


 Share

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

Recommended Posts

The left menu on my website is dynamic and it is based off a recordset from my filemaker database. My left menu is included on every page of my website and I do not want the find of the recordset to occur every time a user browses to a different page. I am looking for a way to store the results in a session so that it only has to look for them once per session. The code that creates my leftbar menu looks like this:

<?php // FMStudio v1.0 - do not remove comment, needed for DreamWeaver support ?>

<?php

$categories_find = $Rackspace->newFindCommand('vehiclesearchsmall');

$categories_findCriterions = array('VehicleCategory'=>'=='.$_SESSION['make'],'VehicleId'=>$_SESSION['model'],'year'=>$_SESSION['year'],);

foreach($categories_findCriterions as $key=>$value) {

    $categories_find->AddFindCriterion($key,$value);

}



fmsSetPage($categories_find,'categories',10000); 



$categories_find->addSortRule('SubCategory2',1,FILEMAKER_SORT_ASCEND); 



$categories_result = $categories_find->execute(); 



if(FileMaker::isError($categories_result)) {$error = 'yes';} else { 



fmsSetLastPage($categories_result,'categories',10000); 



$categories_row = current($categories_result->getRecords());

}



?>



<?php $lis = array();  

foreach ($categories_result->getRecords() as $cer)  {

    $tac = $cer->getField('SubCategory2');

    $lis[$tac] = (!isset($lis[$tac])) ? 1 : $lis[$tac] +1 ;

	

}  

foreach ($lis as $nam => $valu)  {



 echo '<dd class="categories" style="border-bottom:1px dotted #999;"><a href="cilist.php?VehicleCategory='. $_SESSION['make'] .'&SubCategory2=' . $nam . '&VehicleId=' .$_SESSION['model'] . '&year='   . $_SESSION['year']  . '" >' . $nam  .'</a> '. '(' . $valu . ')' . '</dd>';

 

}



 ?>

I tried storing the $categories_row in a session variable but it would only give me one result. I am stuck here any help would be greatly appreciated.

Link to comment
Share on other sites

This topic is 4400 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.