-
Notifications
You must be signed in to change notification settings - Fork 1
/
company.php
83 lines (80 loc) · 2.16 KB
/
company.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
session_start();
include("class.company.dao.php");
include_once("header.php");
$dao = new DAOcompany();
?>
<center><b><u><font face ="Britannic Bold"><h1>Company</h1></font></u></b></center><br>
<a href="form.company.php" class="btn btn-info" role="button">Add Company</a> <br>
<table class="table table-striped">
<thead>
<tr class ="info">
<td>#</td>
<td>Title</td>
<td>Phone</td>
<td>Fax</td>
<td>Email</td>
<td>City</td>
<td>State</td>
<td>Pin Code</td>
<td>Country</td>
<td>Address</td>
<td><b>Edit</b></td>
<td><b>Delete</b></td>
</tr>
</thead>
<?php
$rec_per_page = 10;
if(isset($_GET['page']))
$page = $_GET['page'];
else
$page = 1;
$limit1 = ($page-1)*$rec_per_page;
$limit2 = ($page)*$rec_per_page;
$total_recs = $dao->getCount();
$rec = $dao->getAllByUser($_SESSION["uid"], $limit1, $limit2);
$pages = ceil($total_recs/$rec_per_page);
if($page==1) $prev = $page;
else $prev=$page-1;
if($page==$pages) $next = $page;
else $next=$page+1;
$i = 0;
if ($rec) foreach($rec as $row) {
$i++;
?>
<tbody>
<tr>
<td><? echo $i; ?> </td>
<td><? echo $row->title ?> </td>
<td><? echo $row->phone ?> </td>
<td><? echo $row->fax ?> </td>
<td><? echo $row->email ?> </td>
<td><? echo $row->city ?> </td>
<td><? echo $row->state ?> </td>
<td><? echo $row->pin_code ?> </td>
<td><? echo $row->country ?> </td>
<td><? echo $row->address ?> </td>
<th><a href='form.company.php?id=<? echo $row->comp_id ?>'><img src="img/edit.png" width = 20 height = 20/></a></th>
<th><a href='delete.company.php?id=<? echo $row->comp_id ?>'><img src="img/del.png" width = 20 height = 20/></a></th>
</tr>
</tbody>
<?}
else echo "<tr><td colspan='10'><center><br><br><br><b>No Companies are added yet.</b></center></td></tr>";
?>
</table>
<?
if($page != 1){
?> <a href="company.php?page=<?=$prev?>" style="margin-right:20px">Prev</a>
<?}
for ($p =1; $p<=$pages ; $p++){
?> <a href="company.php?page=<?=$p?>"><?=$p."/".$pages?></a>
<?
}
if($page != $pages){
?><a href="company.php?page=<?=$next?>" style="margin-left:20px">Next</a>
<a href="company.php?page=<?=$pages?>"style="margin-left:12px">Last</a><br />
<?}
?>
<?php
include("footer.php");
?>