Hii , programmers,
This is my controller function.

function index() {

$result=$this->IssueLibraryItem->query("select id,title from
library_items where library_items.id in (select
issue_library_items.library_item_id from issue_library_items where
return_date is null);");
$options = array();
foreach($result as $value)
{
 $index = $value['library_items']['id'];
 $options[$index] = $value['library_items']['title'];
}
$this->set('options',$options);
                $this->IssueLibraryItem->recursive = 0;
                $this->set('issueLibraryItems', $this->paginate());

}

And  my index.ctp

<th class="actions"><?php __('Actions');?></th>
</tr>
<?php echo debug($options); ?>
<?php
$i = 0;
foreach ($issueLibraryItems as $issueLibraryItem):
        $class = $options;
        if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
        }

?>
        <tr<?php echo $class;?>>
                <td>
                        <?php echo $issueLibraryItem['IssueLibraryItem']['id']  
?>
                </td>

                <td>

                        <?php echo $html->link($issueLibraryItem['LibraryItem']
['title'],array('controller' => 'library_items', 'action' => 'view',
$issueLibraryItem['LibraryItem']['id']));?>
                </td>
                <td>
                        <?php echo 
$html->link($issueLibraryItem['Member']['name'],array
('controller' => 'members', 'action' => 'view', $issueLibraryItem
['Member']['id'])); ?>
                </td>
                <td>
                        <?php echo 
$issueLibraryItem['IssueLibraryItem']['issue_date']; ?>
                </td>
                <td>
                        <?php echo 
$issueLibraryItem['IssueLibraryItem']['due_date']; ?>
                </td>
                <td>
                        <?php echo 
$issueLibraryItem['IssueLibraryItem']['return_date']; ?>
                </td>

But my index shows the whole issueed items in the list. But i like to
display only the items that should come according to the query
result.
How can I solve this problem. Please help me

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to