Php: Simple User Query
In here: http://alpha.isaactuling.com/listuser.php There are list of pupils. I want you to create a new script based on it named opponentmatcher.php. The purpose of this script is to search and match for the suggested opponent of your username.
There will be a new input box in the Opponent Matcher page. A single input box and a submit button. Once the username is entered, it will show you a list of usernames that you can fight with.
If the username I entered is “jehzlau”, it should show me the usernames at level 8 only. Because jehzlau is Level 10, all you need to do is show the usernames 2 Levels Lower than the entered username.
When I enter Jehzlau, the Opponent Matcher Page will then show me this:
######################################################################
Level 8 Usernames are the opponent matches for your username:
1. blahblahblah1
2. blahblahblah2
3. blahblahblah3
######################################################################
That’s the result of the query. If in level 8, there are 3 usernames: blahblahblah1, blahblahblah2, and blahblahblah3.
Here are some conditions in other levels:
1. If I enter a username that is only level 1, then the script should show me the usernames in Level 0. (-1 only for level 1 usernames)
2. If I enter a username that is only level 2, then the script should still show me the username in Level 0. (I think this is just -2)
3. If there are still no users in that certain level, the script will add 1 level and show the users. For example I entered a level 10 username, if the database has level 8 users, then show the level 8 users, else, show the level 9 users. If there are no level or level 9 users, then echo this: There are no opponent matches for your username.
I think all you need to do is -2, if there are no results, -1, if stil there are no results, error.
That’s it!



