My login system opens a different window if the username &password written correspond to a simple user or an ADMIN.
I got 3 tables:
"cursadas" includes:(id, user_id[is the foreign key to the column "id" of the table "usuarios"], subject_id[is the foreign key to the column "id" of the table "materias"], grade, date)
"usuarios" includes:(id,username,name,lastname,password,type,status,date)
"materias" includes:(id, career_id, name, description, hours)
This is the table "usuarios":
So,when i write a simple user (type & status = 1) a page only for simple users appears:
So,this is my new goal to my program:
Do not know how to do the query :S
Here is my user dashboard ("info_user"):
<table class="table table-hover" align="center" border="1" cellspacing="0" cellpadding="0" width="700" id="tabla_busqueda">
<thead>
<th>id</th>
<th>User</th>
<th>Name</th>
<th>Lastname</th>
<th>Date</th>
</thead>
<tbody>
<?php
if (count($records) > 0 && $records != false) {
$id = 1;
foreach($records as $record) {
echo "<tr>
<td>".$id."</td>
<td>".$record['username']."</td>
<td>".$record['name']."</td>
<td>".$record['lastname']."</td>
<td>".$record['date']."</td>
</tr>";
$id++;
}
}
?>
</tbody>
</body>
</html>
My controller function:
public function info_user(){
$data['records']=$this->m_login->getINFO();
$this->load->view('info_user',$data);
}
And the model function "getInfo" (do not know how to do the query):
public function getINFO()
{
$st = $this->db->SELECT()
->join()
->join()
->WHERE()
->get()->result_array();
return $st;
}
See Question&Answers more detail:
os