I have just started PHP programming and have the following scenario;
- My contact list is saved in mysql database (Fname, Lname, phone) = done
- Take user input as imagining it taking from a mobile keypad .i.e. 'abc' corresponds to 1, 'def corresponds to 2 etc.
- Let's say user enters "738"...this would correspond to 'PET' and so will 'REU'.
- What the php code is suppose to do is get the user input in the form of digits and search through the mysql database going through the last name to see if it corresponds to any of the name and finally list those contact(s). However, since 'SET' is also a valid combination of 738 BUT if it does not exist in the database, it will not get displayed.
Question: how can i take the input in digits and generate all possible combination to match against the database? I guess i will have to use arrays to store the mobile keypad mapping and somehow do the permutations stuff. Any help will be appreciated.