-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchPaymentNumber.php
More file actions
35 lines (30 loc) · 932 Bytes
/
fetchPaymentNumber.php
File metadata and controls
35 lines (30 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include('DB_connect.php');
// Check if the student ID is set and valid
if (isset($_GET['student_id']) && !empty($_GET['student_id'])) {
$student_id = intval($_GET['student_id']);
// Prepare the query to fetch the payment number for the student
$query = "SELECT student_contact_number1 FROM students WHERE student_id = ?";
$stmt = $connect->prepare($query);
if ($stmt) {
$stmt->bind_param('i', $student_id);
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {
// Output the latest payment number
echo htmlspecialchars($row['student_contact_number1']);
} else {
// No payment number found
echo '';
}
$stmt->close();
} else {
// Error preparing statement
echo '';
}
$connect->close();
} else {
// Invalid student ID
echo '';
}
?>