-
Notifications
You must be signed in to change notification settings - Fork 46
/
check_availability.php
29 lines (27 loc) · 951 Bytes
/
check_availability.php
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
<?php session_start();
require_once("includes/config.php");
if(!empty($_POST["cid"])) {
$cid= $_POST["cid"];
$regid=$_SESSION['login'];
$result =mysqli_query($con,"SELECT studentRegno FROM courseenrolls WHERE course='$cid' and studentRegno=' $regid'");
$count=mysqli_num_rows($result);
if($count>0)
{
echo "<span style='color:red'> Already Applied for this course.</span>";
echo "<script>$('#submit').prop('disabled',true);</script>";
}
}
if(!empty($_POST["cid"])) {
$cid= $_POST["cid"];
$result =mysqli_query($con,"SELECT * FROM courseenrolls WHERE course='$cid'");
$count=mysqli_num_rows($result);
$result1 =mysqli_query($con,"SELECT noofSeats FROM course WHERE id='$cid'");
$row=mysqli_fetch_array($result1);
$noofseat=$row['noofSeats'];
if($count>=$noofseat)
{
echo "<span style='color:red'> Seat not available for this course. All Seats Are full</span>";
echo "<script>$('#submit').prop('disabled',true);</script>";
}
}
?>