Jump to content

drop menu


networkthis

Recommended Posts

I am trying to populate a drop menu from mysql...I would like to not have locations that have already displayed to be redisplayed.  There are a lot of duplicated locations.  Each location only needs to be displayed one time in the menu.  I have a seperate search function written to display mysql results based on selected location.

 

Any ideas or suggestions would be great!  Thanks in advance

<?php
$query="SELECT location FROM jb";


$result = mysql_query ($query);echo "<select name=category value=''></option>";

while($nt=mysql_fetch_array($result)){

echo "<option value=$nt[location]>$nt[location]</option>";


}echo "</select>";

?> 

Link to comment
https://forums.phpfreaks.com/topic/131878-drop-menu/
Share on other sites

awesome thank you so much!!!  Now that brings up another question... where is there a good source for all of the different things you can do with mysql querys and some examples for the mysql querys???

 

Also how difficult is it to sort these alphabetically?     

Link to comment
https://forums.phpfreaks.com/topic/131878-drop-menu/#findComment-685118
Share on other sites

awesome thank you so much!!!  Now that brings up another question... where is there a good source for all of the different things you can do with mysql querys and some examples for the mysql querys???

 

Google it: http://google.com/search?q=mysql+tutorials

 

You'll find all sorts of tutorials and documentation for MySQL.

 

OK I actually knew the answer for the sorting, just forgot!!!  Is this the most efficient way though?

 

Yep, it is.

Link to comment
https://forums.phpfreaks.com/topic/131878-drop-menu/#findComment-685122
Share on other sites

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.