Hi Team
I need help, how only the course that the student is registered in and also course status in php and html.
Hi Team
I need help, how only the course that the student is registered in and also course status in php and html.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sangeetha SRank #212 · 11.4K reputationPosted Nov 26, 2024, 7:49 AM EST
Hi,
mysqli.Database Structure
courses table:
id(int, primary key)course_name(varchar)status(varchar)registrations table:
id(int, primary key)student_id(int)course_id(int)connect_error) { die("Connection failed: " . $mysqli->connect_error); } // Assuming we have the student ID $student_id = 1; // Replace with dynamic value based on logged-in student // SQL query to fetch the registered courses and their status $sql = "SELECT c.course_name, c.status FROM registrations r JOIN courses c ON r.course_id = c.id WHERE r.student_id = ?"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("i", $student_id); $stmt->execute(); $result = $stmt->get_result(); $courses = []; while ($row = $result->fetch_assoc()) { $courses[] = $row; } $stmt->close(); $mysqli->close(); ?>Registered CoursesYour Registered CoursesYou are not registered in any courses. Course NameStatus