I have some sql that searches a db table for a number from a form input.
An good example would be the following rows:
124
1240
12400
124000
My sql is a simple like statement:
SELECT NUMBER FROM TABLE WHERE NUMBER LIKE '$number%'
If the use searched for 124, I would get find 4 rows which is fine.
My question is, if the user typed in 12400000, how can I return the row with 124000?
I’m assuming that I would need to loop back through the number until a row is found?
My input requires a min of 3 numbers before the sql is run, so I would want to stop the loop at 3 numbers.
With php and or SQL, is there a method that allows me to count back on a string to a defined point; string back to the 3rd Character?
Just make an array from that input and use the
IN: