<?php include("config.php"); ?
>
<!DOCTYPE html><html><head><title>page2</title>
<link rel="stylesheet" type="text/css" href="home.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.4.2/css/all.min.css" integrity="sha512-
z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbb
KuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<nav>
<div class="logo">
<p>DREAM P</p>
</div>
<div class="but">
<button class="but1"
onclick="document.location='login.html'">login</button>
<button class="but1">signup</button></div>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="property.php">property</a></li>
<li><a href="contact.php">contact us</a></li>
<li><a href="about.php">about us</a></li></ul>
</nav>
<div class="search">
<table class="search1">
<tr><td><input type="text" placeholder="Search"
class="search2"></td>
<td><a href="#"><i class="fa-solid fa-magnifying-
glass"></i></a></td></tr>
</table>
</div>
<div class="dashboard">
<?php
$query = "SELECT COUNT(*) AS total FROM uploaded";
$result = mysqli_query($con, $query);
if ($result && mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$totalCount = $row['total'];
} else {
$totalCount = 0;
}
$query = "SELECT id FROM uploaded ORDER BY id DESC LIMIT 1";
$result = mysqli_query($con, $query);
if ($result && mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$lastId = $row['id'];
} else {
$lastId = 0;
}
?>
<div class="dashboard1">
<p>Uploded Files</p>
<p><?php echo $lastId; ?></p>
</div>
<div class="dashboard1">
<p>booked Land</p>
<p>0</p>
</div>
<div class="dashboard1">
<p>booked House</p>
<p>0</p>
</div>
<div class="dashboard1">
<p>available properties</p>
<p><?php echo $totalCount; ?></p>
</div>
</div>
<div class="dash">
<?php
if(isset($_POST['submit'])){
$file=$_POST['file'];
$category=$_POST['category'];
$province=$_POST['province'];
$district=$_POST['district'];
$sector=$_POST['sector'];
$cell=$_POST['cell'];
$village=$_POST['village'];
$value=$_POST['value'];
$query= "INSERT INTO
uploaded(file,category,province,district,sector,cell,village,value)
VALUES('$file', '$category',
'$province','$district','$sector','$cell','$village','$value')";
$results = mysqli_query($con,$query);
if(!$results){
die("Not inserted".mysqli_error($con));
}
echo "Recorded successfully";
}
?>
<h1>Uploading files from your device</h1>
<form action="" method="post">
<input type="file" name="file" class="upload" multiple>
<select class="select" name="category"><option>land</option>
<option>house</option></select>Category<br>
<input type="text" placeholder="province" class="place" name="province">
<input type="text" placeholder="district" class="place" name="district">
<input type="text" placeholder="sector" class="place" name="sector">
<input type="text" placeholder="cell" class="place" name="cell">
<input type="text" placeholder="village" class="place" name="village">
<input type="text" placeholder="value Rwf" class="place" name="value"><br>
<div class="butto"><button
name="submit">send</button><button>reset</button>
</form>
</div>
<div class="dashboard4">
<?php
$query = "SELECT * FROM uploaded";
$result = mysqli_query($con, $query);
if (mysqli_num_rows($result) > 0) {
// Start generating the HTML table
echo '<table>';
echo
'<th>S/n</th><th>prodID</th><th>Category</th><th>Location</th><th>value</
th><th>selectors</th>';
// Iterate over each row of data
while ($row = mysqli_fetch_assoc($result)) {
// Extract the values from the current row
$id = $row['id'];
$file = $row['file'];
$category = $row['category'];
$province = $row['province'];
$district = $row['district'];
$sector = $row['sector'];
$cell = $row['cell'];
$village = $row['village'];
$value = $row['value'];
echo "<tr>";
echo "<td>$id</td><td>$file</td><td>$category</td><td>$province,
$district, $sector, $cell, $village</td><td>$value</td>";
echo "<td><i class='fa-solid fa-trash'></i><i class='fa-solid fa-pen-
to-square'></i><i class='fa-solid fa-location-dot'></i></td>";
echo "</tr>";
}
echo '</table>';
} else {
echo "No data found in the 'uploaded' table.";
}
?></div><br><br>
</body></html>