░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
lon105.truehost.cloud
LOCATION:
/home/ilrtztmy/woodcoffiefurnitureworks.com/api/models
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: Category.php
<?php class Category{ private $conn; private $table_name = "categories"; public $id; public $name; public $slug; public $image; public $sort_order; public $created_at; public function __construct($db){ $this->conn = $db; } function read(){ $query = "SELECT id, name, slug, image, sort_order, created_at FROM " . $this->table_name . " ORDER BY sort_order DESC"; $stmt = $this->conn->prepare($query); $stmt->execute(); return $stmt; } function readOne(){ $query = "SELECT id, name, slug, image, sort_order, created_at FROM " . $this->table_name . " WHERE id = ? LIMIT 0,1"; $stmt = $this->conn->prepare( $query ); $stmt->bindParam(1, $this->id); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $this->name = $row["name"]; $this->slug = $row["slug"]; $this->image = $row["image"]; $this->sort_order = $row["sort_order"]; $this->created_at = $row["created_at"]; } function create(){ $query = "INSERT INTO " . $this->table_name . " SET name=:name, slug=:slug, image=:image, sort_order=:sort_order"; $stmt = $this->conn->prepare($query); $this->name=htmlspecialchars(strip_tags($this->name)); $this->slug=htmlspecialchars(strip_tags($this->slug)); $this->image=htmlspecialchars(strip_tags($this->image)); $this->sort_order=htmlspecialchars(strip_tags($this->sort_order)); $stmt->bindParam(":name", $this->name); $stmt->bindParam(":slug", $this->slug); $stmt->bindParam(":image", $this->image); $stmt->bindParam(":sort_order", $this->sort_order); if($stmt->execute()){ return true; } return false; } function update(){ $query = "UPDATE " . $this->table_name . " SET name = :name, slug = :slug, image = :image, sort_order = :sort_order WHERE id = :id"; $stmt = $this->conn->prepare($query); $this->name=htmlspecialchars(strip_tags($this->name)); $this->slug=htmlspecialchars(strip_tags($this->slug)); $this->image=htmlspecialchars(strip_tags($this->image)); $this->sort_order=htmlspecialchars(strip_tags($this->sort_order)); $this->id=htmlspecialchars(strip_tags($this->id)); $stmt->bindParam(":name", $this->name); $stmt->bindParam(":slug", $this->slug); $stmt->bindParam(":image", $this->image); $stmt->bindParam(":sort_order", $this->sort_order); $stmt->bindParam(":id", $this->id); if($stmt->execute()){ return true; } return false; } function delete(){ $query = "DELETE FROM " . $this->table_name . " WHERE id = ?"; $stmt = $this->conn->prepare($query); $this->id=htmlspecialchars(strip_tags($this->id)); $stmt->bindParam(1, $this->id); if($stmt->execute()){ return true; } return false; } }
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 Category.php
PHP
3.4 KB
2026-06-18 14:10
EDIT
📄 Product.php
PHP
5.8 KB
2026-06-18 14:10
EDIT
📄 Quote.php
PHP
2.8 KB
2026-06-18 14:10
EDIT