Are you getting unknown column in where clause ? If yes then here is the solution. May be you forgot to use single quote before and after your variable.
Try the given code and change table, column names accordingly.
$query="select * from students where regd_no='".$enrollment_no."' ";
Thanks for visiting.