public function find_companies()
 {
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::id(), tpl_companies::active(), tpl_companies::name()), array(tpl_companies::active() => 1));
     $data = $db->get_where();
     $w = '';
     foreach ($data as $row) {
         $w = $w . '<option value="' . $row[tpl_companies::id()] . '">' . $row[tpl_companies::name()] . '</option>';
     }
     return $w;
 }
 public function count_companies()
 {
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::id()), array(tpl_companies::active() => 1));
     return count($db->get_where());
 }
                        <th data-field="<?php 
echo tpl_students::students() . '_' . tpl_students::first_name();
?>
"
                            data-halign="center" data-sortable="true">students name
                        </th>

                        <th data-field="<?php 
echo tpl_degree::degree() . '_' . tpl_degree::name();
?>
"
                            data-halign="center" data-sortable="true">degree name
                        </th>

                        <th data-field="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::name();
?>
"
                            data-halign="center" data-sortable="true">companies name
                        </th>

                        <th data-field="<?php 
echo tpl_onus_designate::status();
?>
"
                            data-halign="center"
                            data-formatter="operate<?php 
echo tpl_onus_designate::status();
?>
"
                            data-sortable="true">Done
 public function find($id)
 {
     $db = new data_base(tpl_companies::companies(), array("*"), array(tpl_companies::id() => $id));
     $results = $db->get_where();
     if (!empty($results)) {
         return $results;
     } else {
         return false;
     }
 }
                        <th data-field="<?php 
echo tpl_trainer::id();
?>
" data-halign="center" data-sortable="true"> id</th>
                        <th data-field="<?php 
echo tpl_trainer::name();
?>
"
                            data-formatter="operate<?php 
echo tpl_trainer::trainer();
?>
"
                            data-halign="center" data-sortable="true"> name
                        </th>
                        <th data-field="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id();
?>
" data-halign="center" data-sortable="true">
                            companies
                        </th>
                        <th data-field="<?php 
echo tpl_university::address();
?>
" data-halign="center" data-sortable="true">
                            address
                        </th>
                        <th data-field="<?php 
echo tpl_university::active();
?>
"
                            data-halign="center"
 public function get_all_companies()
 {
     if (isset($_POST['id_category'])) {
         $id = $_POST['id_category'];
         if (!empty($id)) {
             $db = new data_base(tpl_companies::companies(), array(tpl_companies::id(), tpl_companies::name()), array(tpl_companies::id_category() => $id, tpl_companies::active() => 1));
             $data = $db->get_where();
             $w = '   <option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_specialty::id()] . '">' . $row[tpl_specialty::name()] . '</option>';
             }
             echo $w;
         } else {
             echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error empty'));
         }
     } else {
         echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error isset'));
     }
 }
 public function find_department()
 {
     if (isset($_POST[tpl_companies::id() . '_' . tpl_companies::companies()])) {
         $id = $_POST[tpl_companies::id() . '_' . tpl_companies::companies()];
         if (!empty($id)) {
             $db = new data_base(tpl_department::department(), array(tpl_department::id(), tpl_department::name()), array(tpl_department::active() => 1, tpl_department::id_companies() => $id));
             $data = $db->get_where();
             $w = '<option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_department::id()] . '">' . $row[tpl_department::name()] . '</option>';
             }
             echo $w;
         } else {
             echo 'error';
             exit;
         }
     } else {
         echo 'error';
         exit;
     }
 }
 public function find_all_ajax()
 {
     $db = new data_base(tpl_trainer::trainer(), array(tpl_trainer::id(), tpl_trainer::status(), tpl_trainer::name(), data_base::select_multiple_table(tpl_department::department(), tpl_department::department() . '.' . tpl_department::id(), tpl_trainer::trainer() . '.' . tpl_trainer::id_department(), tpl_department::name(), tpl_department::department() . '_' . tpl_department::name()), data_base::select_multiple_table(tpl_section::section(), tpl_section::section() . '.' . tpl_section::id(), tpl_trainer::trainer() . '.' . tpl_trainer::id_section(), tpl_section::name(), tpl_section::section() . '_' . tpl_section::name()), data_base::select_multiple_table(tpl_companies::companies(), tpl_companies::companies() . '.' . tpl_companies::id(), tpl_trainer::trainer() . '.' . tpl_trainer::id_companies(), tpl_companies::name(), tpl_companies::companies() . '_' . tpl_companies::name())));
     echo json_encode($db->get());
 }
?>
"/>
                    </div>


                    <div class="form-group">
                        <label>Category <?php 
echo tpl_companies::companies();
?>
 : </label>
                        <select name="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id_category() . '_update';
?>
"
                                id="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id_category() . '_update';
?>
"
                                class="form-control">
                            <?php 
$new = new companies_lib_ad();
echo $new->find_category();
?>
                        </select>
                    </div>

                    <button type="submit" class="btn btn-success" id="update" name="update">Save</button>
                </form>
                </br>
                </br>
                <div class="" id="result_massages_update"></div>
</h4>
                    <h4>University : <?php 
echo $data[tpl_university::university() . '_' . tpl_university::name()];
?>
</h4>
                    <h4>College : <?php 
echo $data[tpl_college::college() . '_' . tpl_college::name()];
?>
</h4>


            </div>

            <div class="col-sm-6">
                    <h4>companies : <?php 
echo $data_co[tpl_companies::companies() . '_' . tpl_companies::name()];
?>
</h4>
                    <h4>Department : <?php 
echo $data_co[tpl_department::department() . '_' . tpl_department::name()];
?>
</h4>
                    <h4>Section : <?php 
echo $data_co[tpl_section::section() . '_' . tpl_section::name()];
?>
</h4>
            </div>
            <div class="row">
                <table class="table table-bordered">
                    <thead>
                    <tr>
?>
"
                            data-halign="center" data-sortable="true">
                            section
                        </th>


                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function operate<?php 
echo tpl_companies::companies();
?>
(value, row) {

        return '<a href="<?php 
echo site_url('admin/companies/view/?id=');
?>
' + row.<?php 
echo tpl_college::id();
?>
 + '">' + value + '</a>'
    }

</script>
 public function find_all_ajax()
 {
     $db = new data_base(tpl_onus_designate::onus_designate(), array(tpl_onus_designate::id(), tpl_onus_designate::id_onus(), tpl_onus_designate::id_student(), tpl_onus_designate::id_models(), tpl_onus_designate::id_degree(), tpl_onus_designate::status(), data_base::select_multiple_table(tpl_onus::onus(), tpl_onus::onus() . '.' . tpl_onus::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_onus(), tpl_onus::name(), tpl_onus::onus() . '_' . tpl_onus::name()), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_student(), tpl_students::first_name(), tpl_students::students() . '_' . tpl_students::first_name()), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_student(), tpl_students::last_name(), tpl_students::students() . '_' . tpl_students::last_name()), data_base::select_multiple_table(tpl_degree::degree(), tpl_degree::degree() . '.' . tpl_degree::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_degree(), tpl_degree::name(), tpl_degree::degree() . '_' . tpl_degree::name()), data_base::select_multiple_table(tpl_companies::companies(), tpl_companies::companies() . '.' . tpl_companies::id(), data_base::select_multiple_table(tpl_models::models(), tpl_models::models() . '.' . tpl_models::id(), tpl_onus_designate::onus_designate() . '.' . tpl_onus_designate::id_models(), tpl_models::id_companies()), tpl_companies::name(), tpl_companies::companies() . '_' . tpl_companies::name())));
     echo json_encode($db->get());
 }