<?php 
$fid=$this->session->userdata('fir_id');
$sid=$this->session->userdata('sec_id');

$find_curr=$this->db->query("select * from coin_info where coid='".$fid."'")->row();
$ex2=$find_curr->coin_symbol;
$find_curr1=$this->db->query("select * from coin_info where coid='".$sid."'")->row();
$ex1=$find_curr1->coin_symbol;
?>
<br>
<h4 class="atitle"> <i class="fa fa-book"> </i> Trade History</h4>
<hr>
<br>
        <div class="table-responsive">
                  <table>
                    <thead>
                      <tr>
                       <th>Time</th>
                        <th>Price</th>
                        <th>Amount(<?php echo $ex2;?>)</th>
                        <th>Total (<?php echo $ex1;?>)</th>
                      </tr>
                    </thead>
                    <tbody>
                    <?php
                    $res=$this->db->query("select * from exchange where type in('3','4') and status='1' and pair='".$fid."' and market_type='".$sid."'and exchange_mode='0'  order by date desc limit 10");
                     $row=$res->result();
                     if($row)
                     {
                          $s=0;
                          foreach($row as $row)
                          {
                            $s++;

                          ?>
                      
                      <tr>
                        <td><?php echo $row->date;?></td>
                        <?php
                          if($row->type=='3')
                          {
                        ?>
                        <td><span class="green"><?php echo $row->price;?></span></td>
                        <?php
                        }
                        else
                        {
                      ?>
                       <td><span class="purple"><?php echo $row->price;?></span></td>

                      <?php
                      }
                      ?>
                        <td><?php echo $row->amount;?></td>
                        <td><?php echo $row->total;?></td>                     
                      </tr>
                      <?php
                      }
                    }
                    else
                    {
                      ?>
                      <tr>
                        <td colspan='4' align="center"> No data available in table </td>
                      </tr>
                      <?php

                    }
                    ?>
                      
                    </tbody>
                  </table>
                </div>