-
Notifications
You must be signed in to change notification settings - Fork 10
/
list.php
45 lines (42 loc) · 1.36 KB
/
list.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
<?php
/*
Author : Suresh Pokharel
Email : suresh.wrc@gmail.com
GitHub : github.com/suresh021
URL : psuresh.com.np
*/
?>
<?php
/*Database Connection*/
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'dm';
Global $dbconfig; // to use globally
$dbconfig = mysqli_connect($host,$username,$password,$database) or die("An Error occured while connecting to the database");
?>
<?php
$result=mysqli_query($dbconfig,"SELECT * FROM todo");
?>
<table class="table" id=todoListTable>
<thead>
<th class="col-md-1">ID</th>
<th class="col-md-9">Title</th>
<th class="col-md-2"> <div class="pull-right">Action</div></th>
</thead>
<tbody>
<?php $i=1;?>
<?php while($res = mysqli_fetch_assoc($result)){?>
<tr>
<td class="col-md-1"><?=$i;$i++;?></td>
<td class="col-md-9"><?=$res['description']?></td>
<td class="col-md-2">
<div class="btn-group pull-right">
<a title="Delete" class="btn btn-danger btn-xs delete-button" id="delete_<?=$res['id']?>" onclick="DeleteItem(<?=$res['id']?>);"><span class='glyphicon glyphicon-trash'></span></a>
<a style="margin-left: 2px" title="Edit" class="btn btn-info btn-xs edit-button" id="edit_<?=$res['id']?>" onclick="checks(<?=$res['id']?>,'<?=$res['description']?>');"><span class='glyphicon glyphicon-edit'></span></a>
</div>
</td>
</tr>
<?php }?>
</tbody>
</table>