Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi 2 all i want to display the tabel styled using css i'm new to codeigniter


model

<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User_Model extends CI_Model
{
    function __construct()
    {
        parent::__construct();
        
    }
    
    function entry_insert($data)
    {
         
        
        $this->db->insert('applicants',$data);
    }
    
    function get_entery($title)
    {
        
        
        
         
          
        return  $this->db->where('postiontitle', $title)->get('applicants')->result(); 
        
    }
}



view
XML
<html>

<head>

<link rel="stylesheet" type="text/css" href="./assets/main.css"/>

</head>
<body>
<div id="main_container">


</div>

</body>

</html>




controller

XML
<?php

class Adminc extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->model('User_Model' , "user");
    }
    public function index( )

    {
        $this->load->view('admin');
        $title="android developer";
        $users = $this->user->get_entery($title);
        //var_dump($users);
        foreach ($users as $user)
        {

            echo"<table>";
            echo"<tr>";

            echo"<td>".$user->fullname."</td>";
             echo"<td>".$user->age."</td>";
              echo"<td>".$user->phonenumber."</td>";
               echo"<td>".$user->expectedsalary."</td>";
               echo"<td>".$user->email."</td>";



               echo"<td>".$user->experence."</td>";

               echo"<td>".$user->testquestion."</td>";
               echo"<td>".$user->answer."</td>";
            echo"</tr>";
             echo"</table>";

        }

    }
}


?>
Posted
Comments
Sergey Alexandrovich Kryukov 27-Nov-13 13:34pm    
This is code dump, not a question. Do you have any questions?
—SA
TheSniper105 27-Nov-13 16:14pm    
my question was is how to display the values of $users in the view
note that $users is array which contain values from database
Zeeshan17 30-Aug-14 12:51pm    
But let us know what issue you are facing.

If you are unable to render the table properly just move the <table> and </table> out of foreach loop.

Feel free to let me know more details and doubts.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900