Welcome Guest, Not a member yet? Register   Sign In
need help,,, reverse foreach or reverse the query
#5

[eluser]H8train[/eluser]
ok that at least got me some output but no content. my view looks like this:
Code:
<h3>&lt;?=$row->title?&gt;</h3>

    <small>Posted on: &lt;?=$row->date?&gt;</small><br>
    <p>&lt;?=$row->body?&gt;</p><br>
    <p>&lt;?=anchor('blog/comments/'.$row->id, 'comments');?&gt;</p>

its not grabbing the actual content and my anchor link doesnt contain the post ID anymore so the comments won't work correctly.



ok heres all that I have that works properly:

from My blog.php controller
Code:
function index()
        {
        
            $data['query'] = $this->db->get('entries');

            
            $this->load->view('blog_view', $data);
            
        }

from my blog_view.php view file:
Code:
<p>

    &lt;?php foreach($query->result() as $row): ?&gt;

    <h3>&lt;?=$row->title?&gt;</h3>

    <small>Posted on: &lt;?=$row->date?&gt;</small><br>
    <p>&lt;?=$row->body?&gt;</p><br>
    <p>&lt;?=anchor('blog/comments/'.$row->id, 'comments');?&gt;</p>
    
<hr>    

&lt;?php endforeach; ?&gt;


</p>

and my output is flowing like this:

Code:
Post 1 date 2005

Post 2 date 2006

Post 3 date 2007
but I want my output to flow like this:
Code:
Post 3 date 2007

Post 2 date 2006

Post 1 date 2005

I just want the newly posted data to be added at the top and not the bottom.

if anyone can help me to achieve this it would be greatly appreciated. I am new to PHP and would think this is an easy fix to a seasoned PHP coder.

Thank you for your replies.

Rich


Messages In This Thread
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 04:10 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 05:42 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 06:22 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 07:02 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 08:13 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 08:55 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 09:18 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 09:35 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 09:51 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 10:11 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 10:20 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 11:02 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-25-2007, 11:04 PM
need help,,, reverse foreach or reverse the query - by El Forum - 10-26-2007, 01:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB