0

I have form with select option from MySQL table. Because I want unique option I add SELECT DISTINCT... But I have values like: R15 and R15C now I want to combine this two to only 15 show in select option?

Curent code:

$result = $conn->query("SELECT DISTINCT diameter FROM tires WHERE cat = 'cars' ORDER BY diameter ASC"); while($rows = $result->fetch_assoc()){ $diameter = $rows['diameter']; ?>
<option value="<?php echo $diameter; ?>"><?php echo $diameter; ?></option>
Dharman
  • 30,962
  • 25
  • 85
  • 135
RoX
  • 15
  • 5
  • you got to add some sample data, your question is not clear enough, we don't know what you want to combine and what should it be based on – Flash Thunder Nov 01 '20 at 08:17
  • You're going to try and fuzzy up the distinct query with something like this... https://stackoverflow.com/questions/12165400/fuzzy-distinct-values – jpmc Nov 01 '20 at 08:26
  • ok. currently i have in mysql... R13,R14,R13,R15,R15C,R16,R14,R15,.... with Select Distinct i get: R13,R14,R15,R15C,... but I want to get: R13,R14,R15,R16...thank you – RoX Nov 01 '20 at 08:28

1 Answers1

0

I just added this to make it work

AND premer NOT LIKE '%C%'
Dharman
  • 30,962
  • 25
  • 85
  • 135
RoX
  • 15
  • 5