My database column is a varchar(25)
datatype with values 1 1/2", 1/2", 3", and 4" representing hose diameters for a fire station. The issue I am having is that the following code spits out the hose diameters in the above order in the database when I want to order in ascending order, meaning I want "1/2, 1 1/2, 3, 4" not with the 1 1/2 at the front. IS there a way to do this in SQL with fractional data values for my varchar
datatype?
// Select hose locations from fire database
$query = "SELECT hose_diameter FROM hose_diameter ORDER BY hose_diameter";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
//FETCH ROWS
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
print "<option value=\"".$row['hose_diameter']."\">".$row['hose_diameter']."</option>";
}
}