░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
lon105.truehost.cloud
LOCATION:
/home/ilrtztmy/woodcoffiefurnitureworks.com/api/models
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: Product.php
<?php class Product{ private $conn; private $table_name = "products"; public $id; public $category_id; public $name; public $slug; public $price; public $description; public $image; public $featured; public $stock; public $status; public $created_at; public $updated_at; public function __construct($db){ $this->conn = $db; } function read(){ $query = "SELECT c.name as category_name, p.id, p.category_id, p.name, p.slug, p.price, p.description, p.image, p.featured, p.stock, p.status, p.created_at, p.updated_at FROM " . $this->table_name . " p LEFT JOIN categories c ON p.category_id = c.id ORDER BY p.created_at DESC"; $stmt = $this->conn->prepare($query); $stmt->execute(); return $stmt; } function readOne(){ $query = "SELECT c.name as category_name, p.id, p.category_id, p.name, p.slug, p.price, p.description, p.image, p.featured, p.stock, p.status, p.created_at, p.updated_at FROM " . $this->table_name . " p LEFT JOIN categories c ON p.category_id = c.id WHERE p.id = ? LIMIT 0,1"; $stmt = $this->conn->prepare( $query ); $stmt->bindParam(1, $this->id); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $this->category_id = $row["category_id"]; $this->name = $row["name"]; $this->slug = $row["slug"]; $this->price = $row["price"]; $this->description = $row["description"]; $this->image = $row["image"]; $this->featured = $row["featured"]; $this->stock = $row["stock"]; $this->status = $row["status"]; $this->created_at = $row["created_at"]; $this->updated_at = $row["updated_at"]; $this->category_name = $row["category_name"]; } function create(){ $query = "INSERT INTO " . $this->table_name . " SET category_id=:category_id, name=:name, slug=:slug, price=:price, description=:description, image=:image, featured=:featured, stock=:stock, status=:status"; $stmt = $this->conn->prepare($query); $this->category_id=htmlspecialchars(strip_tags($this->category_id)); $this->name=htmlspecialchars(strip_tags($this->name)); $this->slug=htmlspecialchars(strip_tags($this->slug)); $this->price=htmlspecialchars(strip_tags($this->price)); $this->description=htmlspecialchars(strip_tags($this->description)); $this->image=htmlspecialchars(strip_tags($this->image)); $this->featured=htmlspecialchars(strip_tags($this->featured)); $this->stock=htmlspecialchars(strip_tags($this->stock)); $this->status=htmlspecialchars(strip_tags($this->status)); $stmt->bindParam(":category_id", $this->category_id); $stmt->bindParam(":name", $this->name); $stmt->bindParam(":slug", $this->slug); $stmt->bindParam(":price", $this->price); $stmt->bindParam(":description", $this->description); $stmt->bindParam(":image", $this->image); $stmt->bindParam(":featured", $this->featured); $stmt->bindParam(":stock", $this->stock); $stmt->bindParam(":status", $this->status); if($stmt->execute()){ return true; } return false; } function update(){ $query = "UPDATE " . $this->table_name . " SET category_id = :category_id, name = :name, slug = :slug, price = :price, description = :description, image = :image, featured = :featured, stock = :stock, status = :status WHERE id = :id"; $stmt = $this->conn->prepare($query); $this->category_id=htmlspecialchars(strip_tags($this->category_id)); $this->name=htmlspecialchars(strip_tags($this->name)); $this->slug=htmlspecialchars(strip_tags($this->slug)); $this->price=htmlspecialchars(strip_tags($this->price)); $this->description=htmlspecialchars(strip_tags($this->description)); $this->image=htmlspecialchars(strip_tags($this->image)); $this->featured=htmlspecialchars(strip_tags($this->featured)); $this->stock=htmlspecialchars(strip_tags($this->stock)); $this->status=htmlspecialchars(strip_tags($this->status)); $this->id=htmlspecialchars(strip_tags($this->id)); $stmt->bindParam(":category_id", $this->category_id); $stmt->bindParam(":name", $this->name); $stmt->bindParam(":slug", $this->slug); $stmt->bindParam(":price", $this->price); $stmt->bindParam(":description", $this->description); $stmt->bindParam(":image", $this->image); $stmt->bindParam(":featured", $this->featured); $stmt->bindParam(":stock", $this->stock); $stmt->bindParam(":status", $this->status); $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