-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobservation_manager.php
54 lines (47 loc) · 1.54 KB
/
observation_manager.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
<?php
session_start();
//including the database connection file
include_once("connect.php");
//fetching data in descending order (lastest entry first)
$result = mysqli_query($connection, "SELECT * FROM observations ORDER BY id DESC"); // using mysqli_query instead
?>
<html>
<head>
<title>Observation Manager</title>
</head>
<body>
<?php
//Check if loggedin or not
if (isset($_SESSION['username'])){
$username = $_SESSION['username'];
echo "Hi " . $username . " ";
echo "This is the Members Area ";
echo "<a href='logout.php'>Logout</a><br /><br />";
?>
<a href="observation_add.php">Add New Observation</a><br/><br/>
<table width='80%' border=0>
<tr bgcolor='#CCCCCC'>
<td>Scientific Name</td>
<td>Logitude</td>
<td>Latitude</td>
<td>Date</td>
<td>Update</td>
</tr>
<?php
while($res = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$res['scientificname']."</td>";
echo "<td>".$res['longitude']."</td>";
echo "<td>".$res['latitude']."</td>";
echo "<td>".$res['date']."</td>";
echo "<td><a href=\"observation_edit.php?id=$res[id]\">Edit</a> | <a href=\"observation_del.php?id=$res[id]\" onClick=\"return confirm('Are you sure you want to delete?')\">Delete</a></td>";
}
?>
</table>
<?php }
else{
header("Location: login.php");
}
?>
</body>
</html>