|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
php sort by letter
Is there any way with php you can view records in a mysql database table that begin with a given letter. i would like to be able to put an html dropdown box form with all the letters of the alphabet in and when someone selects a given letter then only records which begin with that letter will be displayed.
I need this as i don't want to be displaying 10,000 or so records and making someone scroll down because my list is sorted alphabetically and they want a record beginning with the letter v. Enableing then to just click on the letter v and just having the records beginning with v show up would be much more practical. |
|
#2
|
|||
|
|||
|
This could be done through the mysql query by using the LIKE statement, and wildcards
SELECT col FROM table WHERE col LIKE 'v%' In MySQL, the % char is the wildcard.. Hope that suits your needs ![]()
__________________
Best Regards, Håvard Lindset |
|
#3
|
|||
|
|||
|
thanks loads lindset, i'd tried it with WHERE col LIKE '%v%' which was basically selecting every record with a letter v in it. just removing the front % like your example has sorted it for me.
Thanks again. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > php sort by letter |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|