I have a mysql database with thousands of records, which each have an associated 'method number' ranging from 1 to 9,000. When someone clicks on the links for just the 200s, 300s, 1600s, etc. I want it to show only that grouping. BUT the problem is some the data has letters in it, like 232B, decimals, 200.1, spaces, hyphens, and other non-numerical characteristics. So, if I want to show only 200s for example, my MySQL command should search where method > 199 and <300, -BUT- ignore non-numerical characters, so it will do this:
Query 200s:
200
200A
200B
200.1
205A-modified
232B
239
290.5 C
etc
Anyone know how to get that result through a query + php?
Solved. I did this: each of my links from 200s, 300s, etc will trigger a separate query which passes a $number variable. Then used regex to restrict to the # of chars and find a decimal OR just the digits and $ to end it (so it doesn't match more digits).
Then SELECT * FROM `testmethods` WHERE `methodnumber` REGEXP '^[1][[:digit:]]{2}$' or `methodnumber` REGEXP '^[1][[:digit:]]{2}[.]'
Query 200s:
200
200A
200B
200.1
205A-modified
232B
239
290.5 C
etc
Anyone know how to get that result through a query + php?
Solved. I did this: each of my links from 200s, 300s, etc will trigger a separate query which passes a $number variable. Then used regex to restrict to the # of chars and find a decimal OR just the digits and $ to end it (so it doesn't match more digits).
Then SELECT * FROM `testmethods` WHERE `methodnumber` REGEXP '^[1][[:digit:]]{2}$' or `methodnumber` REGEXP '^[1][[:digit:]]{2}[.]'