forked from graceng-yl/MediPHerD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowse.php
40 lines (37 loc) · 1.26 KB
/
browse.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
<?php
include('header.php');
$query = "SELECT * FROM plants;";
if(!($result = mysqli_query($conn, $query))){
echo "<p>Could not execute query</p>";
die(mysqli_error($conn)."</body.</html>");
}
?>
<div class="container page_content">
<div class="page_top">
<h1 class="page_title">Browse Database</h1>
<p class="page_desc">Collection of all deposited medicinal plants and herbs</p>
</div>
<table class="plant_table">
<thead>
<tr><th>ID</th><th>Scientific Name</th><th>Family</th><th>Common Name</th><th>Usage</th></tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($result)){
?>
<tr id="<?php echo $row['plant_id']; ?>">
<td><?php echo $row['plant_id']; ?></td>
<td><i><?php echo $row['plant_genus']." ".$row['plant_species']; ?></i></td>
<td><?php echo $row['plant_family']; ?></td>
<td><?php echo $row['plant_name'].", ".$row['plant_othernames']; ?></td>
<td><?php echo preg_replace('/((\w+\W*){'.(20-1).'}(\w+))(.*)/', '${1}...', $row['plant_usage']); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
include('footer.php');
?>