This commit is contained in:
Kar l5
2024-06-08 14:27:55 +05:30
commit e67df7f464
37 changed files with 2666 additions and 0 deletions

39
119/view-category.php Normal file
View File

@@ -0,0 +1,39 @@
<table>
<tr>
<td>ID</td>
<td>category</td>
<td> Action </td>
</tr>
<?php
if(isset($_POST['remove_category'])){
$conn = new mysqli(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
$sql = "DELETE FROM `".SHOP_ID."_cat` WHERE `id` = '".$_POST['remove_category']."'";
if ($conn->query($sql) === TRUE) {
echo "Category Removed.";
} else { echo "Error deleting record: " . $conn->error; }
$conn->close();
}
$link = new mysqli(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
$query="SELECT * FROM `".SHOP_ID."_cat` ORDER BY `id` DESC";
$result= mysqli_query($link, $query);
while ($row= mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['category'] ?></td>
<td>
<table>
<td>
<tr><a href="view-product-by-category?category=<?php echo $row['id'] ?>">View items</a> &nbsp; </tr>
<tr><form method="POST"> <input type="hidden" name="remove_category" value="<?php echo $row['id'] ?>" /> <input type="submit" value="Remove" /> </form> </tr>
<tr>&nbsp; <a href="edit-category?category=<?php echo $row['id'] ?>">Edit</a> &nbsp; </tr>
</td>
</table>
</td>
</tr>
<?php
}
$link->close();
?>
</table>