if (isset($_POST['enroll'])) {
$student_id = intval($session->user_id);
$course_id = $course_id;
$date = date('Y-m-d');
我需要PDO功能,如果用戶已經COURSE_ID存在返回false。如何驗證用戶是否已經註冊的課程在PHP
***if ($enroll->student_id has this->course_id) {
$message = "<b>U already enrolled continue</b>";
}else{***
$enroll->user_id = $user_id;
$enroll->course_id = $course_id;
$enroll->en_date = $date;
$enroll->create();
// }
這是我的學生表列
- std_id
- FIRST_NAME
的,這是我的課程表
- COURSE_ID
- 課程名稱
我也有報名表
- ID
- student_id數據
- COURSE_ID
我需要驗證,如果用戶已經使用PHP PDO功能 也採取特定課程的學生人數。
您需要在問題中添加一些代碼。你是否要求SQL查詢來獲得你需要的或者PDO代碼來處理它? – JimL