Untitled

 avatar
unknown
plain_text
a month ago
510 B
6
Indexable
<?php
require_once __DIR__ . '/../../config/database.php';

class Student {
    public static function getAll() {
        global $pdo;
        $stmt = $pdo->query("SELECT * FROM students");
        return $stmt->fetchAll(PDO::FETCH_ASSOC);
    }

    public static function add($full_name, $email, $age) {
        global $pdo;
        $stmt = $pdo->prepare("INSERT INTO students (full_name, email, age) VALUES (?, ?, ?)");
        return $stmt->execute([$full_name, $email, $age]);
    }
}
?>
Editor is loading...
Leave a Comment