You can select day and month using the following sql query:
select *,dayofmonth(doj) as doj_day,month(doj) as doj_month from student_profile where StudentID='$studentid'
Now you can check date in your php code (after data fetching):
if( ($doj_month >= 5) && ($doj_month <= 9) ) {
// date falls between 1st May and 30th Sep
}
Note that you don't really need to fetch doj_day - but if you want to check doj for falling into the 5th May and 23 Jul you must check doj_day too.
Also you can optimize your sql query to fetch only needed rows (check you date directly in sql not in php code) by using "select ... where doj_month>=5 and doj_month<=9"