views:

57

answers:

1

I have a very simple query

$this->db->select('id, title');
$this->db->order_by('id', 'DESC');
$query = $this->db->get('journal');

foreach($query->result() as $row):?>
<ul>
<li><? echo anchor("journal/arc_journal/$row->id", $row->title);?></li>
</ul>
<? endforeach;?>

The data link it produces is perfect, but when my list is displayed it comes out like this

<ul> 
<li>link from above</li>
</ul>

<ul>
<li>link from above</li>
</ul>

etc. Which means I am getting unwanted spaces between my links. My database info is normal, nothing to indicate it should do this.

I get the same type of list if I use an array and the codeigniter ul() html helper.

Any thoughts?

+2  A: 

Does the below not do what you want? If not, please post expected output.

<?php
$this->db->select('id, title');
$this->db->order_by('id', 'DESC');
$query = $this->db->get('journal');
?>

<ul>
foreach($query->result() as $row):?>
<li><? echo anchor("journal/arc_journal/$row->id", $row->title); ?></li>
<? endforeach;?>
</ul>
Joseph Mastey
Worked perfectly, thank you very much. This should have been obvious to me.
Brad