[eluser]Chad Crowell[/eluser]
I am using active record to pull data from the db in the model and push it to the view through the controller, no problem.
If I am pushing a recordset with multiple rows, I have no problems getting data to display with something like this:
Code:
<?php if (is_array($entries)) : foreach ($entries as $entry) : ?>
<h2><a href="<?=site_url('speak/post/'.$entry->id)?>"><?=$entry->entry_title;?></a></h2>
<p><?=$entry->entry_text;?></p>
<? endforeach; else: ?>
<?=$entry;?>
<? endif; ?>
The above code will loop through all records and display them.
However, I can't seem to place the data from the recordset on the page when there is only a single record returned without doing a for each loop, which places the record data into a variable ($entry in the above example). So imagine a blog, and I want to show the info from the db when looking at a post's own page... so I will want the title, body, date, author. But there will only be one row in the recordset returned since this is the specific page for a specific post.
How do I move that one row of data into a variable without using the same code as above, then display the data? I couldn't really find anything concrete in the user guide. I found a few examples but couldn't make them work.