exec("CREATE TABLE IF NOT EXISTS distributors ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); // Check if table is empty $stmt = $pdo->query("SELECT COUNT(*) FROM distributors"); if ($stmt->fetchColumn() == 0) { // Insert initial data $distributors = ['ابن سينا', 'فارما اوفرسيز', 'سوفيكو']; $insert_stmt = $pdo->prepare("INSERT INTO distributors (name) VALUES (?)"); foreach ($distributors as $distributor) { $insert_stmt->execute([$distributor]); } } // Fetch distributors $stmt = $pdo->query("SELECT id, name, created_at FROM distributors ORDER BY id"); $all_distributors = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { echo "
| # | الاسم | تاريخ الإنشاء | الإجراءات |
|---|---|---|---|