•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 361,910 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,589 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 2576 | Replies: 4
![]() |
•
•
Join Date: Apr 2006
Posts: 5
Reputation:
Rep Power: 0
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?
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,866
Reputation:
Rep Power: 32
Solved Threads: 107
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. Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Apr 2006
Posts: 5
Reputation:
Rep Power: 0
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?
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,866
Reputation:
Rep Power: 32
Solved Threads: 107
After you retrieve a MySQL resource array, one usually loops through it to output it. Within that loop, simply use an IF clause, and only output if a particular condition is true.
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
adsense adult advertising biometrics blogging bomb book business coding community copyright development earth engine environment failure forum google internet legal malware marketing mcafee microsoft monetization msn news operating pagerank phishing photo privacy publishing revenue search security seo silverlight software space spyware support system technical universe video web webmaster wiki yahoo
- 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 ?



Linear Mode