转换输入然后比较它并以新的形式显示结果

 _________________________________________________________
|What i must | the value format stored | the result must |
|   type     |      in data base       |   be shown      |
 _________________________________________________________

|  8.30     |            8.5           |     8.30        |
|_________________________________________________________

I'm using a php search page and I want to convert result from sexagesimal(8.30, as I enter) to decimal (8.5), in order to compare it with values in database and then display them as sexagesimal (8.30, as i entered in first time) and not as decimal (8.5, which is the value saved in my data base).
So if there is a direct query that I can use to fetch my search.
btw I can't change type of my database field to TIME because I saved it as VARCHAR to compare between values, because I'm trying to build an attendance system

Converting sexagesimal to decimal

<?php
$sexagesimal = 8.30;
$hour = explode(".",$sexagesimal);
$minutes = $sexagesimal - $hour[0];
$decimalminutes = ($minutes/60)*100;
$decimal = $hour[0] + $decimalminutes;
echo $decimal;
?>

Converting sexagesimal to decimal

<?php
$decimal = 8.5;
$hour = explode(".",$decimal);
$minutes = $decimal - $hour[0];
$sexagesimalminutes = ($minutes/100)*60;
$sexagesimal = $hour[0] + $sexagesimalminutes;
echo $sexagesimal;
?>