Need some work done? Post a Project Today
Create extensions to a simple PHP API script
a. create two methods, the first being /user and /user/1, and the second being /account and /account/2. The will help us see how you break up the url to control the flow and also help us to create our own additional methods
b. create some code that would allow us to connect to a mysql database and inside the relevant functions for the methods above, call the database for data. We know how to code up a connection to a database and retrieve info but we dont know how to do it in a way without creating a new database connection inside each function (i.e. we dont know how to make a global variable for accessing the database)
The code wouldnt need to connect to an acutal database, maybe just include placeholder code for the connection details and then some commented code for the select statements (where you currently have the hard code user data)
In summary it would have four methods
.. and some placeholder code for where we connect to a database.