| | |
Search facility for a drop down box
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2006
Posts: 5
Reputation:
Solved Threads: 0
Hi I'm new here so be gentle!
I have a php form which poppulates an HTML <Select> tag with a list of approx 2500 items which consist of an id; a code and a name. The items come from a MySql database
To make it easier to use I want to be able to optionally limit the number of lines to select from based on a search criteria.
What is the best way of going about this please?
I have a php form which poppulates an HTML <Select> tag with a list of approx 2500 items which consist of an id; a code and a name. The items come from a MySql database
To make it easier to use I want to be able to optionally limit the number of lines to select from based on a search criteria.
What is the best way of going about this please?
You would simply use the WHERE and LIMIT clauses in your MySQL select statement. For example,
SELECT * from mytable; selects all rows from a table named mytable.SELECT col1, col2 from mytable; selects only the columns entitled col1 and col2 from mytable.SELECT col1, col2 from mytable WHERE col1 = 1; selects only the columns entitled col1 and col2 from records where col1 is the value 1.SELECT col1, col2 from mytable WHERE col1 = 1 LIMIT 10; does the same as the previous line only selects just the first ten records it finds, regardless of how many fulfill the WHERE criteria. •
•
Join Date: Apr 2006
Posts: 5
Reputation:
Solved Threads: 0
I need to be able to limit to a search criteria which I wont know until after the page is displayed. I can not construct the where part of the sql at the time I first need the records so I need to be able to search within the record set on the page itself in order to populate the $_Post with the record id.
Does that make sense?
Does that make sense?
![]() |
Similar Threads
- want a search facility (Database Design)
- URGENT: Implementing search with multiple dissimilar MySQL tables (MySQL)
- Where, oh where has my search button gone? (DaniWeb Community Feedback)
- Accessing recent posts. (DaniWeb Community Feedback)
Other Threads in the MySQL Forum
- Previous Thread: Dynamic Next/Prev Buttons in PHP/MySQL
- Next Thread: use of mysql unsigned ?
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api aws bizspark breathalyzer changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization







