File Manager
Editing: db.php
<?php require_once 'config.php'; class Database { private $conn; /* public function __construct() { try { $this->conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if ($this->conn->connect_error) { throw new Exception("Connection failed: " . $this->conn->connect_error); } } catch (Exception $e) { die("Database connection error: " . $e->getMessage()); } } */ public function getUserProducts($user_id, $limit = 6) { $products = []; $user_id = $this->conn->real_escape_string($user_id); $limit = $this->conn->real_escape_string($limit); $query = "SELECT * FROM cards WHERE user_id = '$user_id' AND status = 'active' LIMIT $limit"; $result = $this->conn->query($query); if ($result && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $products[] = $row; } } return $products; } public function getServices($user_id) { // Default services - can be customized per user $defaultServices = [ ['id' => 1, 'name' => 'Consultation', 'description' => 'Professional consultation services for your business needs.', 'icon' => 'fas fa-comments'], ['id' => 2, 'name' => 'Support', 'description' => '24/7 customer support and technical assistance.', 'icon' => 'fas fa-headset'], ['id' => 3, 'name' => 'Development', 'description' => 'Custom software and web development solutions.', 'icon' => 'fas fa-code'], ['id' => 4, 'name' => 'Marketing', 'description' => 'Digital marketing and SEO optimization services.', 'icon' => 'fas fa-bullhorn'] ]; return $defaultServices; } public function close() { if ($this->conn) { $this->conn->close(); } } } ?>
💾 Save
⬅ Back