Sort list into specific locations

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 6, 2018   (RSS)

By degreesnorth - June 5, 2018

Hi Interactive Tools

I have a long list of FAQs, with a drop down list in CMS as to whether they relate to the beginning, at or after the event.  However, I want to group the FAQs according to before, during or after.  Somewhere on the forum you once had code something like (adding a number after the $faqsRecords1), but I can't find the reference to it.


   // load records from 'faqs'
  list($faqsRecords1, $faqsMetaData) = getRecords(array(
    'tableName'   => 'faqs',
    'loadUploads' => true,
    'allowSearch' => false,
      'where' => ' category="Before the Bobbo" ',
));

     // load records from 'faqs'
  list($faqsRecords2, $faqsMetaData) = getRecords(array(
    'tableName'   => 'faqs',
    'loadUploads' => true,
    'allowSearch' => false,
      'where' => ' category="During the Bobbo" ',
));


Then the placement is 
<?php foreach ($faqsRecords1 as $record): ?>  or
<?php foreach ($faqsRecords2 as $record): ?>



...but I think I am missing something as it's not working.  Any ideas?

Thanks in advance.

Carole

By leo - June 6, 2018

Hi Carole,

Changing variable names shouldn't have any impact on the variables, do you have any errors or how do you figure that it's not working? I suppose it's the where statement that's not giving you the correct data.

Leo - PHP Programmer (in training)
interactivetools.com