PHP CodeIgniter Help

purplesmurf

New Member
Messages
1
Reaction score
0
Points
0
Hi, looking for some help with CodeIgniter.

I'll do my best to explain what I need help with but feel free to shout if anything's unclear.

Firstly, I have a db table, fields are id, location_id, vehicle_id, time (stored as int(11) as unix timestamp) and type (varchar(2)). The location_id and vehicle_id fields are joined with another table (vehicles on vehicle_id and locations on location_id). The type field has only two possible options - 'a' and 'd' for 'arrival' and 'departure' respectively. All locations, per vehicle, have a departure time, only some have both an arrival and departure time. Eg:

1, 1, 3, 00:40:00, d;
2, 1, 4, 00:46:00, d;
3, 1, 5, 01:55:00, a;
4, 1, 5, 02:00:00, d;
5, 1, 6, 02:05:00, a;
6, 1, 6, 02:35:00, d;
7, 1, 7, 03:00:00, d;
8, 1, 8, 03:50:00, d;

I need to display this information as follows:

HTML:
<p>Vehicle 1</p>
<table>
  <tr>
    <th>Arrive</th>
    <th>Depart</th>
    <th>Location</th>
  </tr>
  <tr>
    <td>-</td>
    <td>00:40:00</td>
    <td>Location 3</td>
  </tr>
  <tr>
    <td>-</td>
    <td>00:46:00</td>
    <td>Location 4</td>
  </tr>
  <tr>
    <td>01:55:00</td>
    <td>02:00:00</td>
    <td>Location 5</td>
  </tr>
  <tr>
    <td>02:05:00</td>
    <td>02:35:00</td>
    <td>Location 6</td>
  </tr>
  <tr>
    <td>-</td>
    <td>03:00:00</td>
    <td>Location 7</td>
  </tr>
  <tr>
    <td>-</td>
    <td>03:50:00</td>
    <td>Location 8</td>
  </tr>
</table>

I'm able to reproduce this the "long way" with php loops etc, but not sure how to do this with CodeIngiter. Any and all help would be appreciated.

PS
 
Top