• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is this possible with CI AR?

#1
[eluser]mistycabal[/eluser]
I am planning to build an application and am trying to decide whether to use CI or just skip frameworks all together.

I have been playing around with CI and found one thing I'm really stuck on figuring out how to do with the way things are organized in the database results (and I'm not a fan of active record so that could have something to do with it).

Over in a controller I have:

Code:
$data['products_query'] = $this->db->get('products');

And in a view I have:

Code:
<?php foreach($products_query->result() as $product): ?>
<p>Name: &lt;?php echo $product->product_name; ?&gt;</p>
<p>Details: &lt;?php echo $product->product_description; ?&gt;</p>
&lt;?php endforeach; ?&gt;

I want to be able to do something like this:

Code:
&lt;?php foreach($products_query->result() as $product): ?&gt;
<p>Name: &lt;?php echo $product_name; ?&gt;</p>
<p>Details: &lt;?php echo $product_description; ?&gt;</p>
&lt;?php endforeach; ?&gt;

For the life of me, I can't figure out how I would do this. Everything I try so far isn't working. I'm obviously missing the boat on how to make this work if it's easily doable.

Anyone know how?


Messages In This Thread
Is this possible with CI AR? - by El Forum - 08-21-2009, 08:27 PM
Is this possible with CI AR? - by El Forum - 08-21-2009, 08:50 PM
Is this possible with CI AR? - by El Forum - 08-21-2009, 10:14 PM
Is this possible with CI AR? - by El Forum - 08-21-2009, 10:25 PM
Is this possible with CI AR? - by El Forum - 08-21-2009, 10:26 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.