-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditPage.php
More file actions
58 lines (53 loc) · 2.15 KB
/
Copy pathEditPage.php
File metadata and controls
58 lines (53 loc) · 2.15 KB
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
<?php
//including the database connection file
include_once("config.php");
//fetching data in descending order (lastest entry first)
//$result = mysql_query("SELECT * FROM users ORDER BY id DESC"); // mysql_query is deprecated
$result = mysqli_query($mysqli, "SELECT * FROM users ORDER BY id DESC"); // using mysqli_query instead
?>
<html>
<head>
<title>Edit Page</title>
</head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<body>
<div class="wrapper">
<nav>
<div class="container">
<ul>
<li><a href="index.php">HOME</a>
</li>
<li> <a href="add.php">ADD</a> </li>
<li> <a href="EditPage.php">EDIT</a> </li>
<li> <a href="DeletePage.php">DELETE</a> </li>
<li> <a href="search.php">SEARCH</a> </li>
</ul>
</div>
</nav>
<br/><br/>
</div> <div role="main" class="container">
<table id="dataTable" width="75%" class="table table-bordered table-dark table-hover">
<tr >
<td>NAME</td>
<td>AGE</td>
<td>EMAIL</td>
<td>UPDATE</td>
</tr>''
<?php
//while($res = mysql_fetch_array($result)) { // mysql_fetch_array is deprecated, we need to use mysqli_fetch_array
while($res = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$res['name']."</td>";
echo "<td>".$res['age']."</td>";
echo "<td>".$res['email']."</td>";
echo "<td><a href=\"edit.php?id=$res[id]\"><button style=\"width:80%\">Edit</button></a> </td>";
}
?>
</table>
</body>
</html>