From 026ec04c78c0704c9218336101e049d3800d53e4 Mon Sep 17 00:00:00 2001
From: filippo.bertilotti <filippobertilotti@gmail.com>
Date: Mon, 06 May 2024 10:11:40 +0200
Subject: [PATCH] riorganizzazione project, creazione controller (parte 12)

---
 index.php |   29 +++--------------------------
 1 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/index.php b/index.php
index 0f8a6c1..cde5a61 100644
--- a/index.php
+++ b/index.php
@@ -1,28 +1,5 @@
 <?php
-    $dns = "mysql:host=localhost;dbname=product_db;charset=utf8;port=3306";
-    $pdo = new PDO($dns, "product_db_user", "secret", [
-        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
-    ]);
 
-    $stmt = $pdo->query("SELECT * FROM product");
-
-    $products = $stmt->fetchAll(PDO::FETCH_ASSOC);
-    
-    print_r($products);
-?>
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Products</title>
-</head>
-<body>
-    <h1>Products</h1>
-    <?php foreach ($products as $product): ?>
-        <h2><?= htmlspecialchars($product["name"]) ?></h2>
-        <p><?= htmlspecialchars($product["description"]) ?></p>
-    <?php endforeach; ?>
-</body>
-</html>
\ No newline at end of file
+require "controller.php";
+$controller = new Controller;
+$controller->index();
\ No newline at end of file

--
Gitblit v1.8.0