I have store my student database in a table student
. When the session is over I move the database to different table alumni
. And I have form for querying those students where I put session/Year selection. For current session I have no problem querying the database. But for querying previous years student database from alumni in the same form I have no idea how I would query. I just used the following code but this code is limited to one previous year and do not cover the whole past years. Please help me as I am new to this.
$regd=$_GET['regd'];
$yr=$_GET['Year'];
$pyr=date("Y")-1;//Current Year minus one equals to Previous year.
if($yr==$pyr){
$query_pic = "SELECT * FROM alumni WHERE regd='$regd' and Year='$yr'";
}else{
$query_pic = "SELECT * FROM student WHERE regd='$regd' and Year='$yr'";
}
Now I want to dynamically select all the past years student database which were stored in alumni
table.