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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.