🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:Testimonial.php
<?php class Testimonial { private $db; public function __construct(){ $this->db = new Database; } // Get all testimonials public function getTestimonials(){ $this->db->query('SELECT * FROM testimonials ORDER BY id DESC'); return $this->db->resultSet(); } // Get testimonials with pagination public function getTestimonialsPaginated($limit, $offset){ $this->db->query('SELECT * FROM testimonials ORDER BY id DESC LIMIT :limit OFFSET :offset'); $this->db->bind(':limit', $limit); $this->db->bind(':offset', $offset); return $this->db->resultSet(); } // Get total count of testimonials public function getTestimonialsCount(){ $this->db->query('SELECT COUNT(*) as count FROM testimonials'); $row = $this->db->single(); return $row ? $row->count : 0; } // Get testimonial by ID public function getTestimonialById($id){ $this->db->query('SELECT * FROM testimonials WHERE id = :id'); $this->db->bind(':id', $id); return $this->db->single(); } // Add Testimonial public function addTestimonial($data){ $this->db->query('INSERT INTO testimonials (client_name, content) VALUES (:client_name, :content)'); $this->db->bind(':client_name', $data['client_name']); $this->db->bind(':content', $data['content']); if($this->db->execute()){ return true; } else { return false; } } // Update Testimonial public function updateTestimonial($data){ $this->db->query('UPDATE testimonials SET client_name = :client_name, content = :content WHERE id = :id'); $this->db->bind(':id', $data['id']); $this->db->bind(':client_name', $data['client_name']); $this->db->bind(':content', $data['content']); if($this->db->execute()){ return true; } else { return false; } } // Delete Testimonial public function deleteTestimonial($id){ $this->db->query('DELETE FROM testimonials WHERE id = :id'); $this->db->bind(':id', $id); if($this->db->execute()){ return true; } else { return false; } } }
Save Changes
Cancel
Create New File
Create New Folder