Welcome Guest, Not a member yet? Register   Sign In
Confused how to loop to produce tables side by side

HI there all. I am new to codeigniter/php and I am confused as to where/ how to loop through the results to give two tables side by side

what I have now is very standard, I query the database and return the results except for those with "ongoing impacts". The results are then passed to the view and displayed.

I believe it will require a loop and splitting the results into two? Any help would be appreciated. I believe the code should be in the controller?

Table 1
Table 2

Desired Result:
Table 1 | Table 2

This is my code in my controller


class Outage extends Controller {

    function Outage()
    function index()
    $data['query'] = $this->db->get_where('sysoutage', array('status !=' => 'Ongoing Impact'));
        $this->load->view('outage_view', $data);

This is the code in the view

<title>Outages Page</title>
<link href="/outage.css" rel="stylesheet" type="text/css" media="screen">

<?php foreach($query->result() as $row): ?>
<table width="500px">
<td align="center">&lt;?=$row->sysoutpic?&gt;</td>
<td colspan="3" align="center" class="outagesysname">&lt;?=$row->systemname?&gt;</td>
<td class="rowodd">Status:</td><td class="rowodd">&lt;?=$row->status?&gt;</td>
<td class="rowodd">Helpdesk Ref:</td><td class="rowodd">&lt;?=$row->helpdeskref?&gt;</td>
<td class="roweven">Fault Description:</td><td colspan="3" class="roweven">&lt;?=$row->faultdesc?&gt;</td>
<td class="rowodd">Impact:</td><td colspan="3" class="rowodd">&lt;?=$row->impact?&gt;</td>
<td class="roweven">Workaround:</td><td colspan="3" class="roweven">&lt;?=$row->workaround?&gt;</td>
<td class="rowodd">Script:</td><td colspan="3" class="rowodd">&lt;?=$row->script?&gt;</td>
<td class="roweven">Time Started:</td><td class="roweven">&lt;?=$row->timeentered?&gt;</td>
<td class="roweven">Entered By:</td><td class="roweven">&lt;?=$row->enteredby?&gt;</td>
<hr />

&lt;?php endforeach; ?&gt;


I would suggest this is a job for DIVs and CSS

Theme © iAndrew 2016 - Forum software by © MyBB