Jump to content

mySQL and php selecting info without repeats


SkullzY88

Recommended Posts

[the fallowing is just an example]

 

okay this is the problem i have an sql set up with

id - name - date and in them are the fallowing

1 - bob0 - 01.02.08

2 - bob1 - 01.02.08

3 - bob2 - 01.02.08

4 - bob3 - 02.03.08

5 - bob4 - 01.02.08

6 - bob5 - 04.02.08

i want to display this information as a search but i want it displayed by date

now the dates will be displayed by the "<select></select>" but if i do

<?PHP
<select name="date">
$sql = mysql_query("SELECT * FROM db");
while($get = mysql_fetch_array($sql)) {

echo '<option value="'.$get['date'].'">'.$get['date'].'</option>';

}
?>
</select>

if wuld display all the dates as

01.02.08

01.02.08

01.02.08

02.03.08

01.02.08

04.02.08

where i need it to do something like if there is more than 1 of the same date then only display one. so it wuld then show

01.02.08

02.03.08

04.02.08

 

does anyone know how to do this ? (am not very good an explaining stuff so i hope this example helps)

i think it has something to do with mysql_fetch_rows but am not entirely sure ive been searching for tips and tutorials for this but cant seem to find any.

 

thanks for any replies

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.