need help display query in codeignitier view with condition ($Code)

for example i have database :

id  | Code | Name     |  Age |
==============================
1   | 111  | AAAA     |  21  |
2   | 121  | BBBB     |  23  |

and sql query code :

public function detail($Code)
    {
        $tSQL = "select * from table_employee where Code = '{$Code}' ";

        $query = $this->db->query($tSQL);

        return $query->num_rows();

    }

how to display in view

<?php 
if( !empty($detail) ) {                                                                     foreach($detail as $row) { ?>       
<?php echo "<tr>" ?>                                                        <?php echo "<td width='1%'><center>".$row->code;"<center></td>" ?>
<?php echo "<td width='1%'><center>".$row->name;"<center></td>"?>
<?php echo "<td width='1%'><center>".$row->age;"<center></td>"?>                            
<?php }} ?>     

from condition where theres any one know?


ANSWERS:


In view you only need to use tag to your php syntax

 <?php 
    if(!empty($detail) ) {
     foreach($detail as $row) { ?>       
        <tr>
        <td width='1%'><center><?php echo $row->code;?> <center></td>
        <td width='1%'><center><?php echo $row->name;?> <center></td>
        <td width='1%'><center><?php echo $row->age;?><center></td> 
        </tr>                          
    <?php }} ?>   

Try once..

Controller..

public function detail($Code)
    {
        $this->db->where('Code',$Code);
        $data = $this->db->get('table_employee')->result();

        return $data;

    }

In view

foreach($data as $row) { ?>       
    <tr>
    <td width='1%'><center><?php echo $row->code;?> <center></td>
    <td width='1%'><center><?php echo $row->name;?> <center></td>
    <td width='1%'><center><?php echo $row->age;?><center></td> 
    </tr>                          
 <?php } ?>


 MORE:


 ? passing query array to codeigniter view
 ? passing query array to codeigniter view
 ? passing query array to codeigniter view
 ? CodeIgniter passing array with queries into view
 ? How to pass a multi dimensional array to a view in CodeIgniter
 ? Codeigniter not passing array to view
 ? Passing POST value from VIEW to CONTROLLER to MODEL in Codeigniter
 ? Passing POST value from VIEW to CONTROLLER to MODEL in Codeigniter
 ? Passing POST value from VIEW to CONTROLLER to MODEL in Codeigniter
 ? How to pass multiple model functions from controller to view in codeigniter?