Re: [Jason] sorting label problem
Can't get this to work. At the top I have:
list($draft_listRecords, $draft_listMetaData) = getRecords(array(
'tableName' => 'draft_list',
'where' => 'category = 2',
));
list($brewerRecords, $brewerMetaData) = getRecords(array(
'tableName' => 'brewer',
'allowSearch' => false,
'orderBy' => 'brewer ASC'
));
$sortedByBrewers = array();
//create array of brewer numbers
foreach($brewerRecords as $brewer){
$sortedByBrewers[$brewer['num']] = array();
}
//assign each draft list record to it's appropriate brewer record
foreach($draft_listRecords as $draft){
$sortedByBrewers[$draft['brewer']][] = $draft;
}
in the body for my viewer i have:
<ul>
<?php foreach ($sortedByBrewers as $draft): ?>
<?php if ($draft['available']):?>
<li><?php echo $draft['brewer:label'] ?> <?php echo $draft['name'] ?></li>
<?php endif ?>
<?php endforeach ?>
<?php if (!$sortedByBrewers): ?>
<li>We are making changes online. Please check back.</li>
<?php endif ?>
</ul>
I am getting "Notice: Undefined index: available" for each record.
Also tried <?php foreach ($draft_listRecords as $draft): ?> instead of <?php foreach ($sortedByBrewers as $draft): ?> (since im a lost)
Removed:
list($draft_listRecords, $draft_listMetaData) = getRecords(array(
'tableName' => 'draft_list',
'where' => 'category = 2',
));
but through an extra error up top.
So I'm not following how to put this together.
[:/]