Welcome Guest, Not a member yet? Register   Sign In
double last record when using foreach($query->result() as $item)
#3

[eluser]Galford[/eluser]
ok

Model
Code:
function get_all()
    {
        $this->db->order_by('Parameter', 'ASC');
        return $this->db->get('ContactMain');
    }

Controller

Code:
function index()
    {
        $content = "<div class='m_ftp'>Main Contact</div>";
        
        $query = $this->CMM->get_all();
        
        $content .= '<table cellpadding="2" cellspacing="2" align="center" width="100%">';
        
        foreach($query->result() as $item)
        {
            $content .= $this->load->view('Admin/contactmain_show', $item, true);
        }
        
        $content .= $this->load->view('Admin/contactmain_show', $query, true);
        
        $content .= '</table>';
        $this->response['content'] = $content;
        $this->load->view('Admin/index', $this->response);
    }

View:
Code:
<tr>
    <td align="right" class="m_main" width="150px">&lt;?= $Parameter; ?&gt;</td>
    <td align="left">&lt;?= $Value; ?&gt;</td>
    <td width="150px" align='left'>&lt;?= anchor(site_url('Admin/contactmain/edit/'.$Parameter), 'Edit '.$Parameter, 'id="black"'); ?&gt;</td>
</tr>


Messages In This Thread
double last record when using foreach($query->result() as $item) - by El Forum - 07-26-2008, 03:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB