Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
468 B
1
Indexable
<?php
// get_grades.php

// Assuming you have established the database connection already
include_once '../../db_connection/config.php';

$subject = $_GET['subject'];
$studentId = $_GET['student_id'];

$sql = "SELECT * FROM grades WHERE student_id = ? AND subject = ?";
$stmt = $con->prepare($sql);
$stmt->bindParam(1, $studentId);
$stmt->bindParam(2, $subject);
$stmt->execute();
$grades = $stmt->fetch(PDO::FETCH_ASSOC);

echo json_encode($grades);